DropButton

a button that controls a drop

Props

a11yTitle

Custom label to be used by screen readers. When provided, an aria-label will be added to the element.

string
"a user friendly label for screen readers"

alignSelf

How to align along the cross axis when contained in a Box or along the column axis when contained in a Grid.

string
"start"
"center"
"end"
"stretch"

disabled

Whether the button should be disabled.

boolean
true
false

dropAlign

How to align the drop with respect to the button.

object

{
  top: "top" | "bottom",
  bottom: "top" | "bottom",
  right: "left" | "right",
  left: "left" | "right"
}
            

dropContent

Content to put inside the Drop.

element
<Box>...</Box>

dropProps

Any valid Drop prop.

object
{}

dropTarget

Target where the drop will be aligned to. This should be a React reference. Typically, this is not required as the drop will be aligned to the DropButton itself by default.

object
{}

gridArea

The name of the area to place this inside a parent Grid.

string
"a parent grid area name"

margin

The amount of margin around the component.

string
"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
object

Can be specified to distinguish horizontal margin, vertical margin, and margin on a particular side.


{
    vertical: "...",
    horizontal: "...",
    top: "...",
    bottom: "...",
    left: "...",
    right: "..."
}
        

onClose

Callback for when the drop is closed

function
() => {}

onOpen

Callback for when the drop is opened

function
() => {}

open

Whether the drop should be open or not. Setting this property does not influence user interaction after it has been rendered.

boolean
true
false

React/DOM Properties

At its core, the DropButton component is a regular <button> element. Thus, both DOM and React properties, methods, and events are accessible. To read up on all of the possible DOM attributes and types available for button elements, check out this MDN Web Documents page. To learn more about DOM events and methods, you can read more on the MDN Web Events documentation page.

Also, feel free to read about the types of React events available, or see how DOM attributes change in React. Working in tandem with Styled Components, you also have access to the as property.