Home / Function/ SelectWithGroups() — ui Function Reference

SelectWithGroups() — ui Function Reference

Architecture documentation for the SelectWithGroups() function in select-example.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  5832789d_0204_daf5_1591_d8b8110f1674["SelectWithGroups()"]
  da287030_2184_07ad_21e7_133141a5c3fa["select-example.tsx"]
  5832789d_0204_daf5_1591_d8b8110f1674 -->|defined in| da287030_2184_07ad_21e7_133141a5c3fa
  style 5832789d_0204_daf5_1591_d8b8110f1674 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/base/examples/select-example.tsx lines 235–279

function SelectWithGroups() {
  const fruits = [
    { label: "Apple", value: "apple" },
    { label: "Banana", value: "banana" },
    { label: "Blueberry", value: "blueberry" },
  ]
  const vegetables = [
    { label: "Carrot", value: "carrot" },
    { label: "Broccoli", value: "broccoli" },
    { label: "Spinach", value: "spinach" },
  ]
  const allItems = [
    { label: "Select a fruit", value: null },
    ...fruits,
    ...vegetables,
  ]
  return (
    <Example title="With Groups & Labels">
      <Select items={allItems}>
        <SelectTrigger>
          <SelectValue />
        </SelectTrigger>
        <SelectContent>
          <SelectGroup>
            <SelectLabel>Fruits</SelectLabel>
            {fruits.map((item) => (
              <SelectItem key={item.value} value={item.value}>
                {item.label}
              </SelectItem>
            ))}
          </SelectGroup>
          <SelectSeparator />
          <SelectGroup>
            <SelectLabel>Vegetables</SelectLabel>
            {vegetables.map((item) => (
              <SelectItem key={item.value} value={item.value}>
                {item.label}
              </SelectItem>
            ))}
          </SelectGroup>
        </SelectContent>
      </Select>
    </Example>
  )
}

Subdomains

Frequently Asked Questions

What does SelectWithGroups() do?
SelectWithGroups() is a function in the ui codebase, defined in apps/v4/registry/bases/base/examples/select-example.tsx.
Where is SelectWithGroups() defined?
SelectWithGroups() is defined in apps/v4/registry/bases/base/examples/select-example.tsx at line 235.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free