Files
upstream-twenty/packages/twenty-docs/snippets/ui/generated/input/select.mdx
upstream-mirror e7da97194a
Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s
snapshot of https://github.com/twentyhq/twenty.git (main, 2026-09-17; blobs > 131072B omitted)
2026-09-17 23:28:13 +05:00

379 lines
17 KiB
Plaintext

{/*
* _____ _
*|_ _|_ _____ _ __ | |_ _ _
* | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file
* | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten
* |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs
* |___/
*
* This file is generated from the documentation data in packages/twenty-ui/generated.
* To update it, edit the component prop types or design tokens in twenty-ui and run:
* npx nx generate:ui twenty-docs
*/}
### Select.Root
<ParamField body="Root.actionsRef" type="RefObject&lt;SelectRootActions | null&gt;">
A ref to imperative actions.
- `unmount`: Manually unmounts the select.
Call this after any externally controlled closing animation finishes.
</ParamField>
<ParamField body="Root.autoComplete" type="string">
Provides a hint to the browser for autofill.
</ParamField>
<ParamField body="Root.defaultOpen" type="boolean" default="false">
Whether the select popup is initially open.
To render a controlled select popup, use the `open` prop instead.
</ParamField>
<ParamField body="Root.defaultValue" type="SelectValueType&lt;Value, Multiple&gt; | null">
The uncontrolled value of the select when it's initially rendered.
To render a controlled select, use the `value` prop instead.
</ParamField>
<ParamField body="Root.disabled" type="boolean" default="false">
Whether the component should ignore user interaction.
</ParamField>
<ParamField body="Root.form" type="string">
Identifies the form that owns the hidden input.
Useful when the select is rendered outside the form.
</ParamField>
<ParamField body="Root.highlightItemOnHover" type="boolean" default="true">
Whether moving the pointer over items should highlight them.
Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state.
</ParamField>
<ParamField body="Root.id" type="string">
The id of the Select.
</ParamField>
<ParamField body="Root.inputRef" type="Ref&lt;HTMLInputElement&gt;">
A ref to access the hidden input element.
</ParamField>
<ParamField body="Root.isItemEqualToValue" type="((itemValue: Value, value: Value) =&gt; 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.
</ParamField>
<ParamField body="Root.items" type="Record&lt;string, ReactNode&gt; | readonly { label: ReactNode; value: any; }[] | readonly Group&lt;any&gt;[]">
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.
</ParamField>
<ParamField body="Root.itemToStringLabel" type="((itemValue: Value) =&gt; 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.
</ParamField>
<ParamField body="Root.itemToStringValue" type="((itemValue: Value) =&gt; 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.
</ParamField>
<ParamField body="Root.modal" type="boolean" default="true">
Determines 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.
</ParamField>
<ParamField body="Root.multiple" type="boolean" default="false">
Whether multiple items can be selected.
</ParamField>
<ParamField body="Root.name" type="string">
Identifies the field when a form is submitted.
</ParamField>
<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: SelectRootChangeEventDetails) =&gt; void)">
Event handler called when the select popup is opened or closed.
</ParamField>
<ParamField body="Root.onOpenChangeComplete" type="((open: boolean) =&gt; void)">
Event handler called after any animations complete when the select popup is opened or closed.
</ParamField>
<ParamField body="Root.onValueChange" type="((value: SelectValueType&lt;Value, Multiple&gt; | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) =&gt; void)">
Event handler called when the value of the select changes.
</ParamField>
<ParamField body="Root.open" type="boolean">
Whether the select popup is currently open.
</ParamField>
<ParamField body="Root.readOnly" type="boolean" default="false">
Whether the user should be unable to choose a different option from the select popup.
</ParamField>
<ParamField body="Root.required" type="boolean" default="false">
Whether the user must choose a value before submitting a form.
</ParamField>
<ParamField body="Root.value" type="SelectValueType&lt;Value, Multiple&gt; | null">
The value of the select. Use when controlled.
</ParamField>
### Select.Trigger
<ParamField body="Trigger.className" type="string | ((state: SelectTriggerState) =&gt; string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Trigger.disabled" type="boolean">
Whether the component should ignore user interaction.
</ParamField>
<ParamField body="Trigger.nativeButton" type="boolean" default="true">
Whether 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>`).
</ParamField>
<ParamField body="Trigger.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, SelectTriggerState&gt;">
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.
</ParamField>
<ParamField body="Trigger.size" type="&quot;sm&quot; | &quot;md&quot;" default="md">
Visual size of the trigger.
</ParamField>
<ParamField body="Trigger.style" type="CSSProperties | ((state: SelectTriggerState) =&gt; CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
### Select.Value
<ParamField body="Value.children" type="ReactNode | ((value: any) =&gt; ReactNode)">
Accepts a function that returns a `ReactNode` to format the selected value.
Treat the value as read-only: in `multiple` mode it may be a shared frozen array
when nothing is selected.
</ParamField>
<ParamField body="Value.className" type="string | ((state: SelectValueState) =&gt; string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Value.placeholder" type="ReactNode">
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`.
</ParamField>
<ParamField body="Value.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, SelectValueState&gt;">
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.
</ParamField>
<ParamField body="Value.style" type="CSSProperties | ((state: SelectValueState) =&gt; CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
### Select.Popup
<ParamField body="Popup.align" type="&quot;center&quot; | &quot;start&quot; | &quot;end&quot;" default="start">
How to align the popup relative to the specified side.
</ParamField>
<ParamField body="Popup.alignItemWithTrigger" type="boolean" default="false">
Whether 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.
</ParamField>
<ParamField body="Popup.alignOffset" type="number | OffsetFunction" default="0">
Additional 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.
</ParamField>
<ParamField body="Popup.anchor" type="Element | VirtualElement | RefObject&lt;Element | null&gt; | (() =&gt; Element | VirtualElement | null) | null">
An element to position the popup against.
By default, the popup will be positioned against the trigger.
</ParamField>
<ParamField body="Popup.className" type="string | ((state: SelectPopupState) =&gt; string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Popup.container" type="HTMLElement | ShadowRoot | RefObject&lt;HTMLElement | ShadowRoot | null&gt; | null">
Element the popup is portaled into. Defaults to the theme's portal
container.
</ParamField>
<ParamField body="Popup.finalFocus" type="boolean | RefObject&lt;HTMLElement | null&gt; | ((closeType: InteractionType) =&gt; 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.
</ParamField>
<ParamField body="Popup.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, SelectPopupState&gt;">
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.
</ParamField>
<ParamField body="Popup.side" type="&quot;top&quot; | &quot;right&quot; | &quot;bottom&quot; | &quot;left&quot; | &quot;inline-end&quot; | &quot;inline-start&quot;" default="bottom">
Which side of the anchor element to align the popup against.
May automatically change to avoid collisions.
</ParamField>
<ParamField body="Popup.sideOffset" type="number | OffsetFunction" default="8">
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.
</ParamField>
<ParamField body="Popup.style" type="CSSProperties | ((state: SelectPopupState) =&gt; CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
### Select.Item
<ParamField body="Item.className" type="string | ((state: SelectItemState) =&gt; string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Item.description" type="ReactNode">
Supporting text, placed according to `descriptionPlacement`.
</ParamField>
<ParamField body="Item.descriptionPlacement" type="&quot;inline&quot; | &quot;end&quot;" default="inline">
Where the description renders: inline after the content or at the end of
the row.
</ParamField>
<ParamField body="Item.disabled" type="boolean" default="false">
Whether the component should ignore user interaction.
</ParamField>
<ParamField body="Item.endIcon" type="ReactNode">
Icon rendered after the content.
</ParamField>
<ParamField body="Item.label" type="string">
Specifies the text label to use when the item is matched during keyboard text navigation.
Defaults to the item text content if not provided.
</ParamField>
<ParamField body="Item.nativeButton" type="boolean" default="false">
Whether 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.
</ParamField>
<ParamField body="Item.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, SelectItemState&gt;">
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.
</ParamField>
<ParamField body="Item.startIcon" type="ReactNode">
Icon rendered before the content.
</ParamField>
<ParamField body="Item.style" type="CSSProperties | ((state: SelectItemState) =&gt; CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
<ParamField body="Item.value" type="any" default="null">
A unique value that identifies this select item.
</ParamField>
### Select.Group
<ParamField body="Group.className" type="string | ((state: SelectGroupState) =&gt; string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Group.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, SelectGroupState&gt;">
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.
</ParamField>
<ParamField body="Group.style" type="CSSProperties | ((state: SelectGroupState) =&gt; CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
### Select.GroupLabel
<ParamField body="GroupLabel.className" type="string | ((state: SelectGroupLabelState) =&gt; string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="GroupLabel.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, SelectGroupLabelState&gt;">
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.
</ParamField>
<ParamField body="GroupLabel.style" type="CSSProperties | ((state: SelectGroupLabelState) =&gt; CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
### Select.Separator
<ParamField body="Separator.className" type="string | ((state: SelectSeparatorState) =&gt; string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Separator.orientation" type="&quot;horizontal&quot; | &quot;vertical&quot;" default="horizontal">
The orientation of the separator.
</ParamField>
<ParamField body="Separator.render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, SelectSeparatorState&gt;">
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.
</ParamField>
<ParamField body="Separator.style" type="CSSProperties | ((state: SelectSeparatorState) =&gt; CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>