Skip to content

feat: Add Select component for form inputs - #34

Draft
noofreuuuh with Copilot wants to merge 3 commits into
mainfrom
copilot/add-select-component
Draft

noofreuuuh with Copilot wants to merge 3 commits into
mainfrom
copilot/add-select-component

Conversation

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

The design system lacked a native <Select> component, forcing consumers to hand-roll styled <select> elements inconsistently. This adds a fully-featured Select component aligned with the existing Input visual contract.

Component API

<Select
  id="model-select"
  value={selectedValue}
  onChange={(value) => setSelectedValue(value)}
  placeholder="Select a model"
  error="Please select a value"
  size="md"
  fullWidth
>
  <Select.Option value="gpt-4">GPT-4</Select.Option>
  <Select.Option value="claude-3">Claude 3</Select.Option>
</Select>

Key design decisions:

  • onChange receives string directly (not a ChangeEvent) — matches the expected API from the issue
  • error is a string (not boolean) — component owns error message display with aria-describedby wiring
  • Placeholder rendered as disabled hidden option — appears in closed state but cannot be re-selected
  • Select.Option is a compound sub-component wrapping native <option> for ergonomic usage
  • Ref forwarded to the underlying <select> element

Implementation

  • Select.tsxforwardRef wrapper around native <select>, compound with Select.Option
  • Select.module.css — Reuses --lufa-component-input-* tokens for visual parity with Input; size variants (sm/md/lg) use the same padding/font-size token ladder as the input token set
  • Exports: Select, SelectProps, SelectSizeValue

Coverage

  • Playwright CT: a11y, rendering, all states (error, disabled, fullWidth, sizes), onChange value delivery, aria-describedby association, visual regression snapshots
  • Storybook: Default, Placeholder, States, Size, FullWidth stories
  • Docusaurus: live demos + full props reference

Copilot AI linked an issue Jun 4, 2026 that may be closed by this pull request
Copilot AI added 2 commits June 4, 2026 21:20
- Add Select component with Select.Option compound sub-component
- Support placeholder, error message, disabled, fullWidth, size (sm/md/lg)
- Reuse component-input tokens for visual consistency with Input
- Forward ref to native <select> element
- Accessible: aria-invalid, aria-describedby for errors
- Add Playwright CT tests
- Add Storybook stories
- Add Docusaurus examples and documentation
- Add `hidden` attribute to placeholder option to prevent re-selection
- Rename SizeValue to SelectSizeValue for consistent naming
- Remove type alias in exports
Copilot AI changed the title [WIP] Add Select component for form inputs feat: Add Select component for form inputs Jun 4, 2026
Copilot AI requested a review from noofreuuuh June 4, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add Select component for form inputs

2 participants