Lesson 3 — Form primitives
As you add each form component, you should add it’s corresponding Lookbook preview so you can check the appearance. (The Lookbook samples are shown below).
Components::TextInput
|
|
Usage:
|
|
Components::Textarea
|
|
Components::Select
|
|
options accepts either a flat array ["Admin", "Member"] or a
two-dimensional array [["Administrator", "admin"], ["Member", "member"]]
— the same convention as Rails’ options_for_select.
Components::NumberInput
|
|
Components::HiddenInput
HiddenInput is simpler — no label, hint, or error styling needed.
It inherits from Components::Base directly rather than FormField:
|
|
Components::Checkbox
Checkbox has a different layout — the label sits beside the input
rather than above it. It inherits from FormField for the shared props
but overrides view_template entirely:
|
|
Components::RadioGroup
Can be oriented horizontally or vertically.
|
|
Lookbook previews
|
|
|
|
|
|
|
|
|
|
|
|