Skip to content

Conversation

@djalmaaraujo
Copy link
Contributor

@djalmaaraujo djalmaaraujo commented Feb 9, 2026

Description

Add a styled native HTML <select> component inspired by shadcn/ui's native-select.

This provides a lightweight alternative to the custom Select component, using the browser's native select behavior with consistent design system styling.

Components

  • NativeSelect — wrapper with styled <select> and chevron NativeSelectIcon
  • NativeSelectOption — styled <option> element
  • NativeSelectGroup — styled <optgroup> element
  • NativeSelectIcon — customizable chevron icon (supports block override)

Features

  • Disabled state with opacity
  • aria-invalid styling for form validation
  • Form field Stimulus integration (ruby-ui--form-field)
  • TailwindMerge support for class customization

Screenshots

Default Groups
image image
Disabled Invalid
image image

Testing instructions

In the web/ repo:

  1. Point the ruby_ui gem to the local path in Gemfile: gem "ruby_ui", path: "../ruby_ui"
  2. Run bundle install
  3. Install the component: bin/rails g ruby_ui:component NativeSelect
  4. Install docs: bin/rails g ruby_ui:install:docs --force
  5. Add route: get "native_select", to: "docs#native_select", as: :docs_native_select
  6. Add controller action: def native_select; render Views::Docs::NativeSelect.new; end
  7. Add to sidebar menu in app/components/shared/menu.rb
  8. Start the server with bin/dev and visit /docs/native_select
  9. Verify all four examples render correctly (Default, Groups, Disabled, Invalid)

Add a styled native HTML select component inspired by shadcn/ui's
native-select. Includes NativeSelect, NativeSelectOption, and
NativeSelectGroup sub-components with support for size variants
(:default, :sm), disabled state, aria-invalid styling, and form
field integration.
@djalmaaraujo djalmaaraujo requested a review from cirdes as a code owner February 9, 2026 16:30
Move the chevron icon from an inline private method in NativeSelect
into a dedicated NativeSelectIcon component, following the same
pattern as AccordionIcon. Supports block override for custom icons.
Update docs to match the original shadcn native-select page:
Default, Groups, Disabled, Invalid examples with descriptions.
Add Native Select vs Select comparison section.
Copy link
Collaborator

@cirdes cirdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!!

@djalmaaraujo djalmaaraujo merged commit f882429 into main Feb 11, 2026
2 of 4 checks passed
@djalmaaraujo djalmaaraujo deleted the feat-native-select branch February 11, 2026 18:25
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.

2 participants