Skip to content

Commit 19adedc

Browse files
committed
docs: match shadcn native-select examples
Update docs to match the original shadcn native-select page: Default, Groups, Disabled, Invalid examples with descriptions. Add Native Select vs Select comparison section.
1 parent 6cdc58c commit 19adedc

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

lib/ruby_ui/native_select/native_select_docs.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def view_template
2323
RUBY
2424
end
2525

26-
render Docs::VisualCodeExample.new(title: "With groups", context: self) do
26+
render Docs::VisualCodeExample.new(title: "Groups", description: "Use NativeSelectGroup to organize options into categories.", context: self) do
2727
<<~RUBY
2828
div(class: "grid w-full max-w-sm items-center gap-1.5") do
2929
NativeSelect do
@@ -42,30 +42,39 @@ def view_template
4242
RUBY
4343
end
4444

45-
render Docs::VisualCodeExample.new(title: "Small", context: self) do
45+
render Docs::VisualCodeExample.new(title: "Disabled", description: "Add the disabled attribute to the NativeSelect component to disable the select.", context: self) do
4646
<<~RUBY
4747
div(class: "grid w-full max-w-sm items-center gap-1.5") do
48-
NativeSelect(size: :sm) do
48+
NativeSelect(disabled: true) do
4949
NativeSelectOption(value: "") { "Select a fruit" }
5050
NativeSelectOption(value: "apple") { "Apple" }
5151
NativeSelectOption(value: "banana") { "Banana" }
52+
NativeSelectOption(value: "blueberry") { "Blueberry" }
5253
end
5354
end
5455
RUBY
5556
end
5657

57-
render Docs::VisualCodeExample.new(title: "Disabled", context: self) do
58+
render Docs::VisualCodeExample.new(title: "Invalid", description: "Use aria-invalid to show validation errors.", context: self) do
5859
<<~RUBY
5960
div(class: "grid w-full max-w-sm items-center gap-1.5") do
60-
NativeSelect(disabled: true) do
61+
NativeSelect(aria: {invalid: "true"}) do
6162
NativeSelectOption(value: "") { "Select a fruit" }
6263
NativeSelectOption(value: "apple") { "Apple" }
6364
NativeSelectOption(value: "banana") { "Banana" }
65+
NativeSelectOption(value: "blueberry") { "Blueberry" }
6466
end
6567
end
6668
RUBY
6769
end
6870

71+
Heading(level: 2) { "Native Select vs Select" }
72+
73+
div(class: "space-y-2 text-sm text-muted-foreground") do
74+
p { "NativeSelect: Choose for native browser behavior, superior performance, or mobile-optimized dropdowns." }
75+
p { "Select: Choose for custom styling, animations, or complex interactions." }
76+
end
77+
6978
render Components::ComponentSetup::Tabs.new(component_name: component)
7079

7180
render Docs::ComponentsTable.new(component_files(component))

0 commit comments

Comments
 (0)