Class: Shadcn::NativeSelectComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::NativeSelectComponent
- Defined in:
- app/components/shadcn/native_select_component.rb
Overview
Native Select component for styled native HTML selects Matches shadcn/ui Native Select component
Defined Under Namespace
Classes: OptgroupComponent, OptionComponent
Constant Summary collapse
- WRAPPER_CLASSES =
Select wrapper classes for positioning the chevron icon
"relative"- SELECT_CLASSES =
Native select element classes
"h-9 w-full cursor-pointer appearance-none rounded-md border border-input bg-transparent pl-3 pr-8 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50"- CHEVRON_CLASSES =
Chevron icon classes (positioned absolutely)
"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
-
#initialize(name: nil, id: nil, disabled: false, required: false, **options) ⇒ NativeSelectComponent
constructor
A new instance of NativeSelectComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(name: nil, id: nil, disabled: false, required: false, **options) ⇒ NativeSelectComponent
Returns a new instance of NativeSelectComponent.
52 53 54 55 56 57 58 |
# File 'app/components/shadcn/native_select_component.rb', line 52 def initialize(name: nil, id: nil, disabled: false, required: false, **) super(**) @name = name @id = id @disabled = disabled @required = required end |