How to align the drop with respect to the target element. Not specifying a vertical or horizontal alignment will cause it to be aligned in the center.
To prevent creating a new object on each render, the align property should be persistent, either as a static constant outside of the render function or memo-ized using hooks.
For more guidance on when and how to memoize,read the React documentation on the useMemo hook. For using a static constant, see ourDrop component Storybook examples.
object
{
top: "top" | "bottom",
bottom: "top" | "bottom",
right: "left" | "right",
left: "left" | "right"
}
Either a color or identifier to use for the background color. For example: 'neutral-1'. Or, a 'url()' for an image. Dark is not needed if color is provided.
stringA color or image url.
"neutral-1"
"url(//my.com/assets/img.png)"
object
{
color: "neutral-1",
dark: true,
image: "url(//my.com/assets/img.png)"
position: "bottom",
opacity: true,
repeat: "no-repeat",
size: "cover",
light: "string",
clip: "text",
rotate: 45
}
{ dark: "light-2", light: "dark-2" }where opacity could be:
"weak"
"medium"
"strong"
boolean
number
where position could be:
any CSS for background-position
where repeat could be:
"no-repeat"
"repeat"
"string"
where size could be:
"cover"
"contain"
"string"
where clip could be:
"text"
"border-box"
"padding-box"
"content-box"
Elevated height of the target, indicated via a drop shadow. Only applicable if the Drop isn't plain.
string"none"
"xsmall"
"small"
"medium"
"large"
"xlarge"
"any custom elevation name in the current theme"
By default, Drop is rendered using a React Portal, which places it outside the current DOM hierarchy as a child of the body. Sometimes, this isn't desireable and specifying inline indicates that it should be rendered directly as a child of its parent comoponent.
booleantrue
false
The amount of margin around the component.
string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
objectCan be specified to distinguish horizontal margin, vertical margin, and margin on a particular side.
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "..."
}
Function that will be called when the user presses the escape key inside the drop.
function() => {}How to control the overflow inside the drop.
string"auto"
"hidden"
"scroll"
"visible"
"string"
object
{
horizontal: "...",
vertical: "..."
}
Whether the drop element should have no background, elevation, margin or round.
booleantrue
false
Whether focus should be moved to the Drop container if no element within the Drop had autoFocus placed on it.
booleantrue
false
How much to round the corners.
booleantrue
false
string"xsmall"
"small"
"medium"
"large"
"xlarge"
"full"
"string"
object
{
corner: "...",
size: "..."
}
where corner could be:
"top"
"left"
"bottom"
"right"
"top-left"
"top-right"
"bottom-left"
"bottom-right"
If set to true the drop element will be stretched to at least match the width of the target element. The default is true because that is what most uses of Drop want, like Select and Menu.
stringIf set to align the width of the drop element will be restricted to the width of the target element.
"align"
booleantrue
false
Target where the drop will be aligned to.
objectThis should be a React reference.
targetRef.current
At its core, the Drop component is a regular <div> 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 div 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.
The background color of Drop.
stringA hex, name, or rgb value.
"white"
objectAn object with a color for dark and light modes.
{ dark: "black", light: "white" }Any additional style for Drop.
stringAny CSS.
css`color: 'blue'`
function(props) => {}Whether the margin of the Drop should adapt based on the Drop's alignment with respect to its target. Margin will only be applied on the side of the Drop that is adjacent to its target.
booleantrue
false
The possible sizes for the Drop margin.
object
{
none: '0px',
hair: '1px',
xxsmall: '3px',
xsmall: '6px',
small: '12px',
medium: '24px',
large: '48px',
xlarge: '96px',
responsiveBreakpoint: 'small'
}
Elevated height above the underlying context, indicated via a drop shadow.
string"small"
The margin of the drop from the target.
string"none"
"xxsmall"
"xsmall"
"small"
"medium"
"large"
"xlarge"
objectCan be specified to distinguish horizontal margin, vertical margin, and margin on a particular side.
{
vertical: "...",
horizontal: "...",
top: "...",
bottom: "...",
left: "...",
right: "..."
}