gnome-ui
Components

Select

Displays a list of options for the user to pick from—triggered by a button.

Select component
import * as React from 'react';
import { Select } from 'gnome-ui/select';
import { ChevronDown, ChevronUp, Check } from 'lucide-react';

export function SelectDefault() {
  return (
    <Select.Root>
      <Select.Trigger className="flex h-10 w-full max-w-xs items-center justify-between rounded-xl border border-input bg-card px-3 py-2 text-sm text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:border-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring data-[placeholder]:text-muted-foreground">
        <Select.Value placeholder="Select an environment..." />
        <Select.Icon>
          <Icons.ChevronDown className="size-4 opacity-50" />
        </Select.Icon>
      </Select.Trigger>
      
      <Select.Portal>
        <Select.Positioner sideOffset={4} className="z-50 w-[var(--anchor-width)]">
          <Select.Popup className="relative max-h-96 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-md outline-none">
            <Select.ScrollUpArrow className="flex cursor-default items-center justify-center py-1 text-muted-foreground">
              <Icons.ChevronUp className="size-4" />
            </Select.ScrollUpArrow>
            
            <Select.List className="p-1">
              {['GNOME', 'KDE Plasma', 'XFCE', 'Cinnamon', 'Mate'].map((item) => (
                <Select.Item 
                  key={item} 
                  value={item}
                  className="relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
                >
                  <Select.ItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
                    <Icons.Check className="size-4" strokeWidth={3} />
                  </Select.ItemIndicator>
                  <Select.ItemText>{item}</Select.ItemText>
                </Select.Item>
              ))}
            </Select.List>

            <Select.ScrollDownArrow className="flex cursor-default items-center justify-center py-1 text-muted-foreground">
              <Icons.ChevronDown className="size-4" />
            </Select.ScrollDownArrow>
          </Select.Popup>
        </Select.Positioner>
      </Select.Portal>
    </Select.Root>
  );
}

Anatomy

import { Select } from 'gnome-ui/select';

<Select.Root>
  <Select.Trigger>
    <Select.Value />
    <Select.Icon />
  </Select.Trigger>
  <Select.Portal>
    <Select.Positioner>
      <Select.Popup>
        <Select.ScrollUpArrow />
        <Select.List>
          <Select.Item>
            <Select.ItemIndicator />
            <Select.ItemText />
          </Select.Item>
        </Select.List>
        <Select.ScrollDownArrow />
      </Select.Popup>
    </Select.Positioner>
  </Select.Portal>
</Select.Root>

Examples

Grouped Items

You can group related options using <Select.Group> and provide accessible labels using <Select.GroupLabel>.

Select component
import * as React from 'react';
import { Select } from 'gnome-ui/select';
import { ChevronDown, Check } from 'lucide-react';

export function SelectGrouped() {
  return (
    <Select.Root>
      <Select.Trigger className="flex h-10 w-full max-w-xs items-center justify-between rounded-xl border border-input bg-card px-3 py-2 text-sm text-foreground shadow-sm transition-colors hover:bg-accent focus-visible:border-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring">
        <Select.Value placeholder="Select your distribution..." />
        <Select.Icon>
          <Icons.ChevronDown className="size-4 opacity-50" />
        </Select.Icon>
      </Select.Trigger>
      
      <Select.Portal>
        <Select.Positioner sideOffset={4} className="z-50 w-[var(--anchor-width)]">
          <Select.Popup className="relative max-h-96 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-md outline-none">
            <Select.List className="p-1">
              <Select.Group>
                <Select.GroupLabel className="px-8 py-1.5 text-xs font-semibold text-muted-foreground">
                  Debian-based
                </Select.GroupLabel>
                {['Ubuntu', 'Linux Mint', 'Pop!_OS'].map((item) => (
                  <Select.Item key={item} value={item} className="relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground">
                    <Select.ItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
                      <Icons.Check className="size-4" strokeWidth={3} />
                    </Select.ItemIndicator>
                    <Select.ItemText>{item}</Select.ItemText>
                  </Select.Item>
                ))}
              </Select.Group>
              
              <div className="my-1 h-px bg-border" />
              
              <Select.Group>
                <Select.GroupLabel className="px-8 py-1.5 text-xs font-semibold text-muted-foreground">
                  Arch-based
                </Select.GroupLabel>
                {['Arch Linux', 'Manjaro', 'EndeavourOS'].map((item) => (
                  <Select.Item key={item} value={item} className="relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground">
                    <Select.ItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
                      <Icons.Check className="size-4" strokeWidth={3} />
                    </Select.ItemIndicator>
                    <Select.ItemText>{item}</Select.ItemText>
                  </Select.Item>
                ))}
              </Select.Group>
            </Select.List>
          </Select.Popup>
        </Select.Positioner>
      </Select.Portal>
    </Select.Root>
  );
}

Multiple Selection

Pass the multiple prop to allow selecting multiple options simultaneously. The value prop will be an array of the selected items.

Select component

Packages to install: 1

import * as React from 'react';
import { Select } from 'gnome-ui/select';
import { ChevronDown, Check } from 'lucide-react';

export function SelectMultiple() {
  const [value, setValue] = React.useState<string[]>(['git']);

  return (
    <div className="flex w-full max-w-xs flex-col gap-2">
      <Select.Root multiple value={value} onValueChange={setValue}>
        <Select.Trigger className="flex min-h-10 w-full items-center justify-between rounded-xl border border-input bg-card px-3 py-2 text-sm text-foreground shadow-sm transition-colors hover:bg-accent focus-visible:border-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring">
          <div className="flex flex-wrap gap-1">
            {value.length === 0 && <span className="text-muted-foreground">Select packages...</span>}
            {value.length > 0 && <span className="truncate">{value.join(', ')}</span>}
          </div>
          <Select.Icon className="shrink-0 ml-2">
            <Icons.ChevronDown className="size-4 opacity-50" />
          </Select.Icon>
        </Select.Trigger>
        
        <Select.Portal>
          <Select.Positioner sideOffset={4} className="z-50 w-[var(--anchor-width)]">
            <Select.Popup className="relative max-h-96 overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-md outline-none">
              <Select.List className="p-1">
                {['git', 'curl', 'wget', 'htop', 'vim', 'neofetch'].map((item) => (
                  <Select.Item 
                    key={item} 
                    value={item}
                    className="relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground"
                  >
                    <Select.ItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
                      <Icons.Check className="size-4" strokeWidth={3} />
                    </Select.ItemIndicator>
                    <Select.ItemText>{item}</Select.ItemText>
                  </Select.Item>
                ))}
              </Select.List>
            </Select.Popup>
          </Select.Positioner>
        </Select.Portal>
      </Select.Root>
      <p className="text-xs text-muted-foreground">Packages to install: {value.length}</p>
    </div>
  );
}

SelectArrow

Displays an element positioned against the select popup anchor. Renders a &lt;div&gt; element.

Documentation: Base UI Select

API reference

Root

Groups all parts of the select. Doesn’t render its own HTML element.

Root Props:

PropTypeDefaultDescription
namestring-Identifies the field when a form is submitted.
defaultValueValue[] | Value | null-The uncontrolled value of the select when it’s initially rendered.To render a controlled select, use the value prop instead.
valueValue[] | Value | null-The value of the select. Use when controlled.
onValueChange((value: Value[] | Value | any | null, eventDetails: Select.Root.ChangeEventDetails) => void)-Event handler called when the value of the select changes.
defaultOpenbooleanfalseWhether the select popup is initially open.To render a controlled select popup, use the open prop instead.
openboolean-Whether the select popup is currently open.
onOpenChange((open: boolean, eventDetails: Select.Root.ChangeEventDetails) => void)-Event handler called when the select popup is opened or closed.
highlightItemOnHoverbooleantrueWhether moving the pointer over items should highlight them. Disabling this prop allows CSS :hover to be differentiated from the :focus (data-highlighted) state.
actionsRefRefObject<Select.Root.Actions | null>-A ref to imperative actions.* unmount: When specified, the select will not be unmounted when closed. Instead, the unmount function must be called to unmount the select manually. Useful when the select's animation is controlled by an external library.
autoCompletestring-Provides a hint to the browser for autofill.
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.
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.
itemsRecord<string, ReactNode> | ({ label: ReactNode, value: any })[]-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.
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.
multipleboolean | undefinedfalseWhether multiple items can be selected.
onOpenChangeComplete((open: boolean) => void)-Event handler called after any animations complete when the select popup is opened or closed.
disabledbooleanfalseWhether the component should ignore user interaction.
readOnlybooleanfalseWhether the user should be unable to choose a different option from the select popup.
requiredbooleanfalseWhether the user must choose a value before submitting a form.
inputRefRef<HTMLInputElement>-A ref to access the hidden input element.
idstring-The id of the Select.
childrenReactNode--

Trigger

A button that opens the select popup. Renders a <button> element.

Trigger Props:

PropTypeDefaultDescription
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 (e.g. <div>).
disabledboolean-Whether the component should ignore user interaction.
childrenReactNode--
classNamestring | ((state: Select.Trigger.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Trigger.State) => CSSProperties | undefined)-*
renderReactElement | ((props: HTMLProps, state: Select.Trigger.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Trigger Data Attributes:

AttributeTypeDescription
data-popup-open-Present when the corresponding select is open.
data-pressed-Present when the trigger is pressed.
data-disabled-Present when the select is disabled.
data-readonly-Present when the select is readonly.
data-required-Present when the select is required.
data-valid-Present when the select is in valid state (when wrapped in Field.Root).
data-invalid-Present when the select is in invalid state (when wrapped in Field.Root).
data-dirty-Present when the select's value has changed (when wrapped in Field.Root).
data-touched-Present when the select has been touched (when wrapped in Field.Root).
data-filled-Present when the select has a value (when wrapped in Field.Root).
data-focused-Present when the select trigger is focused (when wrapped in Field.Root).
data-placeholder-Present when the select doesn't have a value.

Value

A text label of the currently selected item. Renders a <span> element.

Value Props:

PropTypeDefaultDescription
placeholderReactNode-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.
childrenReactNode | ((value: any) => ReactNode)-Accepts a function that returns a ReactNode to format the selected value.
classNamestring | ((state: Select.Value.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Value.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.Value.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Value Data Attributes:

AttributeTypeDescription
data-placeholder-Present when the select doesn't have a value.

Icon

An icon that indicates that the trigger button opens a select popup. Renders a <span> element.

Icon Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.Icon.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Icon.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.Icon.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Icon Data Attributes:

AttributeTypeDescription
data-popup-open-Present when the corresponding popup is open.

Backdrop

An overlay displayed beneath the menu popup. Renders a <div> element.

Backdrop Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.Backdrop.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Backdrop.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.Backdrop.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Backdrop Data Attributes:

AttributeTypeDescription
data-open-Present when the select is open.
data-closed-Present when the select is closed.
data-starting-style-Present when the select is animating in.
data-ending-style-Present when the select is animating out.

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.

Portal Props:

PropTypeDefaultDescription
containerHTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null-A parent element to render the portal element into.
classNamestring | ((state: Select.Portal.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Portal.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.Portal.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Positioner

Positions the select popup. Renders a <div> element.

Positioner Props:

PropTypeDefaultDescription
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.
disableAnchorTrackingbooleanfalseWhether to disable the popup from tracking any layout shift of its positioning anchor.
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. | | side | Side | 'bottom' | Which side of the anchor element to align the popup against. May automatically change to avoid collisions. | | sideOffset | number \| OffsetFunction | 0 | Distance 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. | | arrowPadding | number | 5 | Minimum 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. | | anchor | Element \| VirtualElement \| RefObject<Element \| null> \| (() => Element \| VirtualElement \| null) \| null | - | An element to position the popup against. By default, the popup will be positioned against the trigger. | | collisionAvoidance | CollisionAvoidance | - | Determines how to handle collisions when positioning the popup. | | collisionBoundary | Boundary | 'clipping-ancestors' | An element or a rectangle that delimits the area that the popup is confined to. | | collisionPadding | Padding | 5 | Additional space to maintain from the edge of the collision boundary. | | sticky | boolean | false | Whether to maintain the popup in the viewport after the anchor element was scrolled out of view. | | positionMethod | 'absolute' \| 'fixed' | 'absolute' | Determines which CSS position property to use. | | className | string \| ((state: Select.Positioner.State) => string \| undefined) | - | CSS class applied to the element, or a function that returns a class based on the component’s state. | | style | CSSProperties \| ((state: Select.Positioner.State) => CSSProperties \| undefined) | - | - | | render | ReactElement \| ((props: HTMLProps, state: Select.Positioner.State) => ReactElement) | - | Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render. |

Positioner Data Attributes:

AttributeTypeDescription
data-open-Present when the select popup is open.
data-closed-Present when the select popup is closed.
data-anchor-hidden-Present when the anchor is hidden.
data-align'start' | 'center' | 'end'Indicates how the popup is aligned relative to specified side.
data-side'none' | 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'Indicates which side the popup is positioned relative to the trigger.

Positioner CSS Variables:

VariableTypeDefaultDescription
--anchor-heightnumber-The anchor's height.
--anchor-widthnumber-The anchor's width.
--available-heightnumber-The available height between the trigger and the edge of the viewport.
--available-widthnumber-The available width between the trigger and the edge of the viewport.
--transform-originstring-The coordinates that this element is anchored to. Used for animations and transitions.

A container for the select list. Renders a <div> element.

Popup Props:

PropTypeDefaultDescription
finalFocusboolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null)-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).
  • RefObject: Move focus to the ref 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. | | children | ReactNode | - | - | | className | string \| ((state: Select.Popup.State) => string \| undefined) | - | CSS class applied to the element, or a function that returns a class based on the component’s state. | | style | CSSProperties \| ((state: Select.Popup.State) => CSSProperties \| undefined) | - | * | | render | ReactElement \| ((props: HTMLProps, state: Select.Popup.State) => ReactElement) | - | Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render. |

Popup Data Attributes:

AttributeTypeDescription
data-open-Present when the select is open.
data-closed-Present when the select is closed.
data-align'start' | 'center' | 'end'Indicates how the popup is aligned relative to specified side.
data-side'none' | 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'Indicates which side the popup is positioned relative to the trigger.
data-starting-style-Present when the select is animating in.
data-ending-style-Present when the select is animating out.

List

A container for the select items. Renders a <div> element.

List Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.List.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.List.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.List.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Arrow

Displays an element positioned against the select popup anchor. Renders a <div> element.

Arrow Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.Arrow.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Arrow.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.Arrow.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Arrow Data Attributes:

AttributeTypeDescription
data-open-Present when the select popup is open.
data-closed-Present when the select popup is closed.
data-uncentered-Present when the select arrow is uncentered.
data-align'start' | 'center' | 'end'Indicates how the popup is aligned relative to specified side.
data-side'none' | 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'Indicates which side the popup is positioned relative to the trigger.

Item

An individual option in the select popup. Renders a <div> element.

Item Props:

PropTypeDefaultDescription
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.
valueanynullA unique value that identifies this select item.
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.
disabledbooleanfalseWhether the component should ignore user interaction.
childrenReactNode--
classNamestring | ((state: Select.Item.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Item.State) => CSSProperties | undefined)-*
renderReactElement | ((props: HTMLProps, state: Select.Item.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Item Data Attributes:

AttributeTypeDescription
data-selected-Present when the select item is selected.
data-highlighted-Present when the select item is highlighted.
data-disabled-Present when the select item is disabled.

ItemText

A text label of the select item. Renders a <div> element.

ItemText Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.ItemText.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.ItemText.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.ItemText.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

ItemIndicator

Indicates whether the select item is selected. Renders a <span> element.

ItemIndicator Props:

PropTypeDefaultDescription
childrenReactNode--
classNamestring | ((state: Select.ItemIndicator.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.ItemIndicator.State) => CSSProperties | undefined)-*
keepMountedboolean-Whether to keep the HTML element in the DOM when the item is not selected.
renderReactElement | ((props: HTMLProps, state: Select.ItemIndicator.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

Group

Groups related select items with the corresponding label. Renders a <div> element.

Group Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.Group.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.Group.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.Group.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

GroupLabel

An accessible label that is automatically associated with its parent group. Renders a <div> element.

GroupLabel Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.GroupLabel.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.GroupLabel.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Select.GroupLabel.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

ScrollUpArrow

An element that scrolls the select popup up when hovered. Does not render when using touch input. Renders a <div> element.

ScrollUpArrow Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.ScrollUpArrow.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.ScrollUpArrow.State) => CSSProperties | undefined)--
keepMountedbooleanfalseWhether to keep the HTML element in the DOM while the select popup is not scrollable.
renderReactElement | ((props: HTMLProps, state: Select.ScrollUpArrow.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

ScrollUpArrow Data Attributes:

AttributeTypeDescription
data-direction'up'Indicates the direction of the scroll arrow.
data-side'none' | 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'Indicates which side the popup is positioned relative to the trigger.
data-visible-Present when the scroll arrow is visible.
data-starting-style-Present when the scroll arrow is animating in.
data-ending-style-Present when the scroll arrow is animating out.

ScrollDownArrow

An element that scrolls the select popup down when hovered. Does not render when using touch input. Renders a <div> element.

ScrollDownArrow Props:

PropTypeDefaultDescription
classNamestring | ((state: Select.ScrollDownArrow.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Select.ScrollDownArrow.State) => CSSProperties | undefined)--
keepMountedbooleanfalseWhether to keep the HTML element in the DOM while the select popup is not scrollable.
renderReactElement | ((props: HTMLProps, state: Select.ScrollDownArrow.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

ScrollDownArrow Data Attributes:

AttributeTypeDescription
data-direction'down'Indicates the direction of the scroll arrow.
data-side'none' | 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'Indicates which side the popup is positioned relative to the trigger.
data-visible-Present when the scroll arrow is visible.
data-starting-style-Present when the scroll arrow is animating in.
data-ending-style-Present when the scroll arrow is animating out.

Separator

A separator element accessible to screen readers. Renders a <div> element.

Separator Props:

PropTypeDefaultDescription
orientationOrientation'horizontal'The orientation of the separator.
classNamestring | ((state: Separator.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component’s state.
styleCSSProperties | ((state: Separator.State) => CSSProperties | undefined)--
renderReactElement | ((props: HTMLProps, state: Separator.State) => ReactElement)-Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.

On this page