Select

A native select component with feedback color states, size variants, and prefix/suffix customization via passThrough.

Feedback

Apply semantic feedback colors to indicate validation state or context.

---
import Select from "../select.astro";
import { stack } from "@pindoba/styled-system/patterns";

const items = [
  { label: "Apple", value: "apple" },
  { label: "Banana", value: "banana" },
  { label: "Cherry", value: "cherry" },
];
---

<div class={stack({ gap: "md", direction: "column" })}>
  <Select feedback="neutral" items={items} />
  <Select feedback="primary" items={items} />
  <Select feedback="success" items={items} />
  <Select feedback="danger" items={items} />
  <Select feedback="warning" items={items} />
</div>

Size

---
import Select from "../select.astro";
import { stack } from "@pindoba/styled-system/patterns";

const items = [
  { label: "Apple", value: "apple" },
  { label: "Banana", value: "banana" },
  { label: "Cherry", value: "cherry" },
];
---

<div class={stack({ gap: "md", direction: "column" })}>
  <Select size="sm" items={items} />
  <Select size="md" items={items} />
  <Select size="lg" items={items} />
</div>

Custom Styling

The passThrough prop provides escape hatches for each slot: style accepts a Panda CSS SystemStyleObject and props forwards arbitrary HTML attributes.

---
import Select from "../select.astro";
import { stack } from "@pindoba/styled-system/patterns";

const items = [
  { label: "Apple", value: "apple" },
  { label: "Banana", value: "banana" },
  { label: "Cherry", value: "cherry" },
];
---

<div class={stack({ gap: "md", direction: "column" })}>
  <Select
    items={items}
    passThrough={{
      root: { style: { borderRadius: "full" } },
    }}
  />
  <Select
    items={items}
    passThrough={{
      select: { style: { fontStyle: "italic" } },
    }}
  />
</div>

Props

Prop
feedback
feedback

Semantic feedback color scheme. neutral: Default. primary: Primary color. success: Green. danger: Red. warning: Orange.

Type "neutral" | "primary" | "success" | "danger" | "warning"
Default "neutral"
Required No
size
size

Size variant. sm: Small. md: Default. lg: Large.

Type "sm" | "md" | "lg"
Default "md"
Required No
background
background

Background fill for the select wrapper.

Type "sunken" | "surface"
Default "sunken"
Required No
items
items

Array of options to display in the select.

Type Array<{ label: string; value?: string; disabled?: boolean }>
Default -
Required Yes
passThrough
passThrough

Custom styling and props for each slot of the select.

Type { root?: { style?: SystemStyleObject; props?: Record<string, unknown> }; select?: { style?: SystemStyleObject; props?: Record<string, unknown> }; option?: { style?: SystemStyleObject; props?: Record<string, unknown> } }
Default undefined
Required No
...rest
...rest

Standard HTML select attributes passed to the inner select element.

Type HTMLAttributes<HTMLSelectElement>
Default -
Required No