Components
Select
A common form component for choosing a predefined value in a dropdown menu.
Usage guidelines#
- Prefer Combobox for large lists: Select is not filterable, aside from basic keyboard typeahead to find items by focusing and highlighting them. Prefer Combobox instead of Select when the number of items is large enough to warrant filtering.
- Special positioning behavior: By default, the select popup overlaps its trigger so the selected item's text is aligned with the trigger's value text. This behavior can be disabled or customized.
- Form controls must have an accessible name: Prefer
<Select.Label>, or provide anaria-labelon<Select.Trigger>when no visible label is rendered. See Labeling a select. - Closing animations: The popup stays rendered until its closing animation finishes. Drive
it with CSS transitions on
[data-starting-style]and[data-ending-style], or use theactionsRefprop on<Select.Root>to finish an externally controlled animation.
Anatomy#
Import the component and assemble its parts:
import { Select } from '@egoist/solid-base/select';
<Select.Root>
<Select.Label />
<Select.Trigger>
<Select.Value />
<Select.Icon />
</Select.Trigger>
<Select.Portal>
<Select.Backdrop />
<Select.Positioner>
<Select.Popup>
<Select.ScrollUpArrow />
<Select.Arrow />
<Select.List>
<Select.Item>
<Select.ItemText />
<Select.ItemIndicator />
</Select.Item>
<Select.Separator />
<Select.Group>
<Select.GroupLabel />
</Select.Group>
</Select.List>
<Select.ScrollDownArrow />
</Select.Popup>
</Select.Positioner>
</Select.Portal>
</Select.Root>;Positioning#
<Select.Positioner> has a special prop called alignItemWithTrigger, which makes its
positioning behave differently by default from other Positioner components. The prop makes the
select popup overlap the trigger so the selected item's text is aligned with the trigger's value
text.
For styling, data-side is "none" on the Popup and Positioner parts while this mode is
active.
To prevent the select popup from overlapping its trigger, set alignItemWithTrigger to false.
When it is true (the default), note the following:
- Interaction type dependent: For UX reasons, the
alignItemWithTriggerpositioning mode is disabled if touch was the pointer type used to open the popup. - Viewport space dependent: There must be enough space in the viewport to align the selected
item's text with the trigger's value text without making the popup too short; otherwise it
falls back to the default positioning mode. Customize this by setting
min-heighton the<Select.Positioner>element: a smaller value falls back less often. The trigger must also be at least 20px from the top and bottom edges of the viewport, or it falls back as well. - Other positioning props are ignored: Props like
sideoralignhave no effect unless the prop is set tofalseor the popup is in fallback mode.
Examples#
Typed wrapper component#
The following example shows a typed wrapper around the Select component with correct type inference and type safety:
import type { JSX } from '@solidjs/web';
import { Select } from '@egoist/solid-base/select';
export function MySelect<Value, Multiple extends boolean | undefined = false>(
props: Select.Root.Props<Value, Multiple>,
): JSX.Element {
return <Select.Root {...props}>{/* ... */}</Select.Root>;
}Formatting the value#
By default, the <Select.Value> component renders the raw value.
Passing the items prop to <Select.Root> instead renders the matching label for the rendered
value:
const items = [
{ value: null, label: 'Select theme' },
{ value: 'system', label: 'System default' },
{ value: 'light', label: 'Light' },
{ value: 'dark', label: 'Dark' },
];
<Select.Root items={items}>
<Select.Value />
</Select.Root>;A function can also be passed as the children of <Select.Value> to render a formatted value:
const items = {
monospace: 'Monospace',
serif: 'Serif',
'sans-serif': 'Sans-serif',
};
<Select.Value>
{(value: keyof typeof items) => <span style={{ 'font-family': value }}>{items[value]}</span>}
</Select.Value>;To avoid a lookup, object values can also be used for each item.
Labeling a select#
Use <Select.Label> to provide a visible label for the select trigger:
<Select.Root>
<Select.Label>Theme</Select.Label>
{/* ... */}
</Select.Root><Select.Label> renders a <div>, so clicking it focuses the select trigger without opening the
popup.
Placeholder values#
To show a placeholder value, use the placeholder prop on <Select.Value>:
const items = [
{ value: 'system', label: 'System default' },
{ value: 'light', label: 'Light' },
{ value: 'dark', label: 'Dark' },
];
<Select.Root items={items}>
<Select.Value placeholder="Select theme" />
</Select.Root>;With placeholders, users cannot clear the selected value using the select itself. If the value
should be clearable from the popup (instead of an external "reset" button), use a null item
rendered in the list itself:
const items = [
{ value: null, label: 'Select theme' },
{ value: 'system', label: 'System default' },
{ value: 'light', label: 'Light' },
{ value: 'dark', label: 'Dark' },
];
<Select.Root items={items}>
<Select.Value />
</Select.Root>;Multiple selection#
Add the multiple prop to <Select.Root> to allow multiple selections.
Object values#
Select items can use objects as values instead of primitives. This gives custom render functions
access to the full object, and can avoid needing items for a lookup. Use itemToStringValue to
serialize the object for form submission.
Controlled#
Pass value and update it from onValueChange. The second argument carries the event details,
including the reason and cancel():
const [theme, setTheme] = createSignal<string | null>('system');
<Select.Root
items={items}
value={theme()}
onValueChange={(value, eventDetails) => setTheme(value)}
>
{/* ... */}
</Select.Root>;Grouped#
Organize related options with <Select.Group> and <Select.GroupLabel> to add section headings
inside the popup.
Groups are represented by an array of objects with an items property, which itself is an array
of the individual items in each group. An extra property, such as value, can provide the heading
text when rendering the group label.
interface ProduceGroupItem {
value: string;
items: string[];
}
const groups: ProduceGroupItem[] = [
{
value: 'Fruits',
items: ['Apple', 'Banana', 'Orange'],
},
{
value: 'Vegetables',
items: ['Carrot', 'Lettuce', 'Spinach'],
},
];API reference#
<Select.Root>
Groups all parts of the select. Doesn't render its own HTML element.
inputRefRefProp<HTMLInputElement>—A ref to access the hidden input element.
namestring—Identifies the field when a form is submitted.
formstring—Identifies the form that owns the hidden input. Useful when the select is rendered outside the form.
autoCompletestring—Provides a hint to the browser for autofill.
idstring—The id of the Select.
requiredbooleanfalseWhether the user must choose a value before submitting a form.
readOnlybooleanfalseWhether the user should be unable to choose a different option from the select popup.
disabledbooleanfalseWhether the component should ignore user interaction.
multipleMultiplefalseWhether multiple items can be selected.
highlightItemOnHoverbooleantrueWhether moving the pointer over items should highlight them. Disabling this prop allows CSS :hover to be differentiated from the :focus (data-highlighted) state.
defaultOpenbooleanfalseWhether the select popup is initially open.
To render a controlled select popup, use the open prop instead.
onOpenChange| ((open: boolean, eventDetails: SelectRootOpenChangeEventDetails) => void)—Event handler called when the select popup is opened or closed.
onOpenChangeComplete((open: boolean) => void)—Event handler called after any animations complete when the select popup is opened or closed.
openboolean—Whether the select popup is currently open.
modalbooleantrueDetermines if the select enters a modal state when open. - true: user interaction is limited to the select: document page scroll is locked and pointer interactions on outside elements are disabled. - false: user interaction with the rest of the document is allowed.
On touch devices, a true modal blocks outside taps but leaves the page scrollable unless the popup spans nearly the full viewport width, matching native iOS behavior.
actionsRefActionsRef<SelectRootActions>—A ref to imperative actions: a ref object ({ current: null }) or a callback receiving them (and null on unmount). - unmount: Ends the closing phase of the select after an externally controlled closing animation finishes. Call preventUnmountOnClose() in onOpenChange first, otherwise the select completes closing on its own. Whether it leaves the DOM is decided by keepMounted on the portal. - close: Closes the select imperatively when called.
itemsSelectItems—Data structure of the items rendered in the select popup. When specified, <Select.Value> renders the label of the selected item instead of the raw value.
itemToStringLabel((itemValue: Value) => string)—When the item values are objects (<Select.Item value={object}>), this function converts the object value to a string representation for display in the trigger. If the shape of the object is { value, label }, the label will be used automatically without needing to specify this prop.
itemToStringValue((itemValue: Value) => string)—When the item values are objects (<Select.Item value={object}>), this function converts the object value to a string representation for form submission. If the shape of the object is { value, label }, the value will be used automatically without needing to specify this prop.
isItemEqualToValue((itemValue: Value, value: Value) => boolean)—Custom comparison logic used to determine if a select item value matches the current selected value. Useful when item values are objects without matching referentially. Defaults to Object.is comparison.
defaultValueSelectInputValue<Value, Multiple> | null—The uncontrolled value of the select when it's initially rendered.
To render a controlled select, use the value prop instead.
valueSelectInputValue<Value, Multiple> | null—The value of the select. Use when controlled.
onValueChange| (( value: SelectOutputValue<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails, ) => void)—Event handler called when the value of the select changes.
<Select.Trigger>
A button that opens the select popup. Renders a <button> element.
disabledboolean—Whether the component should ignore user interaction.
nativeButtonbooleantrueWhether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
data-disabledPresent when the select is disabled.
data-readonlyPresent when the select is readonly.
data-popup-sideIndicates which side the corresponding popup is positioned relative to its anchor.
data-requiredPresent when the select is required.
data-validPresent when the select is in a valid state (when wrapped in Field.Root).
data-invalidPresent when the select is in an invalid state (when wrapped in Field.Root).
data-touchedPresent when the select has been touched (when wrapped in Field.Root).
data-dirtyPresent when the select's value has changed (when wrapped in Field.Root).
data-filledPresent when the select has a value (when wrapped in Field.Root).
data-focusedPresent when the select trigger is focused (when wrapped in Field.Root).
data-placeholderPresent when the select doesn't have a value.
<Select.Label>
An accessible label that is automatically associated with the select trigger. Renders a <div> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.Value>
A text label of the currently selected item. Renders a <span> element.
placeholderJSX.Element—The placeholder value to display when no value is selected. This is overridden by children if specified, or by a null item's label in items.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
data-placeholderPresent when the select doesn't have a value.
<Select.Icon>
An icon that indicates that the trigger button opens a select popup. Renders a <span> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.Portal>
A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to <body>. Renders a <div> element.
containerPortalContainer—A parent element to render the portal element into.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.Backdrop>
An overlay displayed beneath the select popup. Renders a <div> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.Positioner>
Positions the select popup. Renders a <div> element.
alignItemWithTriggerbooleantrueWhether the positioner overlaps the trigger so the selected item's text is aligned with the trigger's value text. This only applies to mouse input and is automatically disabled if there is not enough space.
anchor| Element | null | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null)—An element to position the popup against. By default, the popup will be positioned against the trigger.
Accepts an element, a virtual element, a ref object, or a function (such as a signal accessor) that returns an element or a virtual element.
positionMethod'absolute' | 'fixed''absolute'Determines which CSS position property to use.
sideSide'bottom'Which side of the anchor element to align the popup against. May automatically change to avoid collisions.
sideOffsetnumber | OffsetFunction0Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment.
The function takes a data object parameter with the following properties: - data.anchor: the dimensions of the anchor element with properties width and height. - data.positioner: the dimensions of the positioner element with properties width and height. - data.side: which side of the anchor element the positioner is aligned against. - data.align: how the positioner is aligned relative to the specified side.
alignAlign'center'How to align the popup relative to the specified side.
alignOffsetnumber | OffsetFunction0Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment.
The function takes a data object parameter with the following properties: - data.anchor: the dimensions of the anchor element with properties width and height. - data.positioner: the dimensions of the positioner element with properties width and height. - data.side: which side of the anchor element the positioner is aligned against. - data.align: how the positioner is aligned relative to the specified side.
collisionBoundaryBoundary'clipping-ancestors'An element or a rectangle that delimits the area that the popup is confined to.
collisionPaddingPadding5Additional space to maintain from the edge of the collision boundary.
stickybooleanfalseWhether to maintain the popup in the viewport after the anchor element was scrolled out of view.
arrowPaddingnumber5Minimum distance to maintain between the arrow and the edges of the popup.
Use it to prevent the arrow element from hanging out of the rounded corners of a popup.
disableAnchorTrackingbooleanfalseWhether to disable the popup from tracking any layout shift of its positioning anchor.
collisionAvoidanceCollisionAvoidance—Determines how to handle collisions when positioning the popup.
side controls overflow on the preferred placement axis (top/bottom or left/right): - 'flip': keep the requested side when it fits; otherwise try the opposite side (top and bottom, or left and right). - 'shift': never change side; keep the requested side and move the popup within the clipping boundary so it stays visible. - 'none': do not correct side-axis overflow.
align controls overflow on the alignment axis (start/center/end): - 'flip': keep side, but swap start and end when the requested alignment overflows. - 'shift': keep side and requested alignment, then nudge the popup along the alignment axis to fit. - 'none': do not correct alignment-axis overflow.
fallbackAxisSide controls fallback behavior on the perpendicular axis when the preferred axis cannot fit: - 'start': allow perpendicular fallback and try the logical start side first (top before bottom, or left before right in LTR). - 'end': allow perpendicular fallback and try the logical end side first (bottom before top, or right before left in LTR). - 'none': do not fallback to the perpendicular axis.
When side is 'shift', explicitly setting align only supports 'shift' or 'none'. If align is omitted, it defaults to 'flip'.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
--available-widthThe available width between the trigger and the edge of the viewport.
--available-heightThe available height between the trigger and the edge of the viewport.
--anchor-widthThe anchor's width.
--anchor-heightThe anchor's height.
--transform-originThe coordinates that this element is anchored to. Used for animations and transitions.
<Select.Popup>
A container for the select list. Renders a <div> element.
finalFocusFocusTargetProp—Determines the element to focus when the select popup is closed.
- false: Do not move focus. - true: Move focus based on the default behavior (trigger or previously focused element). - An element or a ref object ({ current }): Move focus to that element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, or false/undefined to do nothing.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.List>
A container for the select items. Renders a <div> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.Item>
An individual option in the select popup. Renders a <div> element.
valueanynullA unique value that identifies this select item.
disabledbooleanfalseWhether the component should ignore user interaction.
labelstring—Specifies the text label to use when the item is matched during keyboard text navigation.
Defaults to the item text content if not provided.
nativeButtonbooleanfalseWhether the component renders a native <button> element when replacing it via the render prop. Set to true if the rendered element is a native button.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
data-selectedPresent when the select item is selected.
data-highlightedPresent when the select item is highlighted.
data-disabledPresent when the select item is disabled.
<Select.ItemIndicator>
Indicates whether the select item is selected. Renders a <span> element.
keepMountedboolean—Whether to keep the HTML element in the DOM when the item is not selected.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.ItemText>
A text label of the select item. Renders a <div> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.Arrow>
Displays an element positioned against the select popup anchor. Renders a <div> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
data-uncenteredPresent when the select arrow is uncentered.
<Select.ScrollDownArrow>
An element that scrolls the select popup down when hovered. Does not render when using touch input. Renders a <div> element.
keepMountedbooleanfalseWhether to keep the HTML element in the DOM while the select popup is not scrollable.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
data-directionIndicates the direction of the scroll arrow.
data-visiblePresent when the scroll arrow is visible.
<Select.ScrollUpArrow>
An element that scrolls the select popup up when hovered. Does not render when using touch input. Renders a <div> element.
keepMountedbooleanfalseWhether to keep the HTML element in the DOM while the select popup is not scrollable.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
data-directionIndicates the direction of the scroll arrow.
data-visiblePresent when the scroll arrow is visible.
<Select.Group>
Groups related select items with the corresponding label. Renders a <div> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.GroupLabel>
An accessible label that is automatically associated with its parent group. Renders a <div> element.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.
<Select.Separator>
A visual separator between items or groups. Renders a <div> element.
orientationOrientation'horizontal'The orientation of the separator.
classstring | ClassValue | ((state: State) => ClassValue)—CSS class applied to the element, or a function that returns a class based on the component's state.
styleJSX.CSSProperties | string | ((state: State) => JSX.CSSProperties | string)—Style applied to the element, or a function that returns a style based on the component's state.
renderkeyof JSX.IntrinsicElements | ((props: HTMLProps, state: State) => JSX.Element)—Allows you to replace the component's HTML element with a different tag, or compose it with another component.
Accepts a tag name, or a function that receives the props to spread and the component's state, and returns the element to render.