Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/components/ruby_ui/form/form_field_label.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ def view_template(&)
private

def default_attrs
{class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}
{
class: [
"text-sm font-medium leading-none",
"peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
"peer-aria-disabled:cursor-not-allowed peer-aria-disabled:opacity-70 peer-aria-disabled:pointer-events-none"
]
}
end
end
end
9 changes: 8 additions & 1 deletion app/components/ruby_ui/input/input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ def default_attrs
ruby_ui__form_field_target: "input",
action: "input->ruby-ui--form-field#onInput invalid->ruby-ui--form-field#onInvalid"
},
class: "flex h-9 w-full rounded-md border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50 border-border focus-visible:ring-ring placeholder:text-muted-foreground"
class: [
"flex h-9 w-full rounded-md border bg-background px-3 py-1 text-sm shadow-sm transition-colors border-border",
"placeholder:text-muted-foreground",
"disabled:cursor-not-allowed disabled:opacity-50",
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
]
}
end
end
Expand Down
18 changes: 18 additions & 0 deletions app/views/docs/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ def view_template
RUBY
end

render Docs::VisualCodeExample.new(title: "Disabled", context: self) do
<<~RUBY
FormField do
FormFieldLabel { "Disabled" }
Input(disabled: true, placeholder: "Joel Drapper", required: true, minlength: "3") { "Joel Drapper" }
end
RUBY
end

render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
<<~RUBY
FormField do
FormFieldLabel { "Aria Disabled" }
Input(aria: {disabled: "true"}, placeholder: "Joel Drapper", required: true, minlength: "3") { "Joel Drapper" }
end
RUBY
end

render Docs::VisualCodeExample.new(title: "Custom error message", context: self) do
<<~RUBY
Form(class: "w-2/3 space-y-6") do
Expand Down
8 changes: 8 additions & 0 deletions app/views/docs/input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ def view_template
RUBY
end

render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
<<~RUBY
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
Input(aria: {disabled: "true"}, type: "email", placeholder: "Email")
end
RUBY
end

render Docs::VisualCodeExample.new(title: "With label", context: self) do
<<~RUBY
div(class: 'grid w-full max-w-sm items-center gap-1.5') do
Expand Down
Loading