JGuang

Select

Select · Chakra UI

Preview
npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0

Select

Used to pick a value from predefined options.

Keep selected value arrays separate from labels. Consult the dedicated guide for native form association, async empty collections and nested overlays.

Included icon notices

The source viewer includes ICON_ATTRIBUTION.md and original notices for the icon collections used by these examples. Preserve them when redistributing examples; react-icons' wrapper license does not replace individual collection terms.

  • Remix Icon: Apache License Version 2.0

Choose one or more values from known options. Use Combobox when users must type a query; consider Native Select for an ordinary native form control. This guide targets Chakra UI 3.37.0, not Chakra v2, Base UI or Radix APIs.

Installation and composition

Complete the Provider and Emotion setup in setup.en.md. The basic example imports Select, Portal and createListCollection from @chakra-ui/react; there is no separate Select npm package.

The complete pinned example is vendor/apps/compositions/src/examples/select-basic.tsx. Create a collection with createListCollection({ items }) and pass it to Select.Root.collection. Keep Select.HiddenSelect for native form association and Select.Label for an accessible name. The trigger contains Select.ValueText; the popup uses Portal, Select.Positioner, Select.Content and Select.Item.

Values and states

  • value is an array, including single selection. Read the new array from onValueChange event details; do not substitute another library's callback signature.
  • multiple enables multiple selection. Use stable unique values; configure itemToValue and itemToString for object collections instead of business identifiers based on array indexes.
  • Root disabled and invalid control interaction or error appearance. Your application still supplies validation and error text.
  • The local inventory retains 20 native examples: sizes, variants, palettes, groups, clear actions, overflow, avatars, countries, form integration and nested overlays, not only the basic appearance.

Async data is not a static collection

select-async-loading also uses react-use@17.6.1 and requests a public Pokémon endpoint. A failed request leaves the original example's collection empty; that is not a successful no-results response. JGuang's CSP blocks this request and explicitly discloses the restriction.

In your application, configure an authorized data source, check HTTP status, distinguish loading/no-results/error states, offer retry, and prevent stale responses from overwriting newer data. JGuang provides no business backend. Resetting the preview does not remove its network restriction.

Overlays, theme and checks

Use the native select-open-from-dialog and select-open-from-popover compositions for nested overlays. Do not accidentally portal the popup outside the modal focus boundary. Retain Chakra semantic tokens and Provider rather than overriding native styling with the platform brand color.

Check arrows, Enter, Escape, Tab, focus return, disabled options, clearing, multiple selection, form submission, both themes and narrow-screen placement. Keyboard selection of Vue.js passed in an independent consumer; this is not acceptance of every example or framework.

Source

Original MDX and examples are retained under vendor at commit 2e7517745cff2fcde0b8012f136cf99611ff262a. This is a JGuang practical guide. See PROVENANCE.md and LOCAL_CHANGES.md for original licenses and dependency adaptations.

Installation and initialization

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0

Initialize ChakraProvider with defaultSystem and Emotion before rendering. Preserve the host React version and inspect peer compatibility. Official npm installation supplies components, not these example source files. Use the resource setup guide for locale, next-themes and framework-specific SSR; copy the selected example source separately from npm installation.

Complete native usage example

This is the actual pinned example, not a generic API mock. Copy its source closure and retain the named export. Additional imports are listed per example below.

"use client"

import { Portal, Select, createListCollection } from "@chakra-ui/react"

export const SelectBasic = () => {
  return (
    <Select.Root collection={frameworks} size="sm" width="320px">
      <Select.HiddenSelect />
      <Select.Label>Select framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select framework" />
        </Select.Trigger>
        <Select.IndicatorGroup>
          <Select.Indicator />
        </Select.IndicatorGroup>
      </Select.Control>
      <Portal>
        <Select.Positioner>
          <Select.Content>
            {frameworks.items.map((framework) => (
              <Select.Item item={framework} key={framework.value}>
                {framework.label}
                <Select.ItemIndicator />
              </Select.Item>
            ))}
          </Select.Content>
        </Select.Positioner>
      </Portal>
    </Select.Root>
  )
}

const frameworks = createListCollection({
  items: [
    { label: "React.js", value: "react" },
    { label: "Vue.js", value: "vue" },
    { label: "Angular", value: "angular" },
    { label: "Svelte", value: "svelte" },
  ],
})

All examples and reproduction requirements

Names identify demos, not component variant props. Copy every sourceFiles entry for the selected example. The compositions alias denotes local files, not a package. Preserve relative imports or rewrite the alias to your project's actual path. React peers are inspected separately; editor examples retain the coherent pinned Tiptap extension family.

Basic

select-basic · Named export SelectBasic · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-basic.tsx

With Sizes

select-with-sizes · Named export SelectWithSizes · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-sizes.tsx

With Variants

select-with-variants · Named export SelectWithVariants · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-variants.tsx

With Color Palette

select-with-color-palette · Named export SelectWithColorPalette · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-color-palette.tsx

With Option Group

select-with-option-group · Named export SelectWithOptionGroup · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 es-toolkit@1.47.0
  • vendor/apps/compositions/src/examples/select-with-option-group.tsx

Controlled

select-controlled · Named export SelectControlled · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-controlled.tsx

Async Loading

select-async-loading · Named export SelectAsyncLoading · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-use@17.6.1
  • vendor/apps/compositions/src/examples/select-async-loading.tsx

With Hook Form

select-with-hook-form · Named export SelectWithHookForm · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 @hookform/resolvers@5.4.0 react-hook-form@7.77.0 zod@4.4.3
  • vendor/apps/compositions/src/examples/select-with-hook-form.tsx

With Disabled

select-with-disabled · Named export SelectWithDisabled · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-disabled.tsx

With Invalid

select-with-invalid · Named export SelectWithInvalid · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-invalid.tsx

With Multiple

select-with-multiple · Named export SelectWithMultiple · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-multiple.tsx

With Positioning

select-with-positioning · Named export SelectWithPositioning · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-positioning.tsx

With Clear

select-with-clear · Named export SelectWithClear · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-clear.tsx

With Overflow

select-with-overflow · Named export SelectWithOverflow · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-overflow.tsx

With Item Description

select-with-item-description · Named export SelectWithItemDescription · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-item-description.tsx

Open From Popover

select-open-from-popover · Named export SelectOpenFromPopover · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-open-from-popover.tsx

Open From Dialog

select-open-from-dialog · Named export SelectOpenFromDialog · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-open-from-dialog.tsx

With Avatar

select-with-avatar · Named export SelectWithAvatar · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0
  • vendor/apps/compositions/src/examples/select-with-avatar.tsx

With Country

select-with-country · Named export SelectWithCountry · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 es-toolkit@1.47.0
  • vendor/apps/compositions/src/examples/select-with-country.tsx

With Icon Button

select-with-icon-button · Named export SelectWithIconButton · original upstream example

npm install @chakra-ui/react@3.37.0 @emotion/react@11.14.0 react-icons@5.6.0
  • vendor/apps/compositions/src/examples/select-with-icon-button.tsx

Native API and source references

The source viewer retains original declarations, imports and inheritance. Ark UI event contracts, Chakra style props and recipe types stay in their native packages; this guide does not flatten or invent their defaults. Code comments remain original source, not translated prose.

  • npm/@chakra-ui/react@3.37.0/dist/types/components/select/index.d.ts
  • npm/@chakra-ui/react@3.37.0/dist/types/components/select/namespace.d.ts
  • npm/@chakra-ui/react@3.37.0/dist/types/components/select/select.d.ts

State and installation checks

Run strict types, the target production build and real interactions. Test labels/focus/keyboard, both themes, narrow layout, empty/loading/error states where supported and cleanup after unmount. Remote demo endpoints, uploads and downloads are constrained in the preview; configure your own services. Copying a command or reaching preview-ready does not prove installation or backend success.

Provenance and license boundaries

https://github.com/chakra-ui/chakra-ui/tree/2e7517745cff2fcde0b8012f136cf99611ff262a

These are JGuang practical bilingual notes, not a full translation of upstream MDX. Original documentation and example bytes remain in vendor. Preserve repository MIT, compositions ISC metadata and separate dependency notices. The original metadata discrepancy and any missing full notices remain explicit review items; paid Chakra Pro is excluded.