0.5.0
ArthurClemens
released this
20 Aug 15:53
·
69 commits
to development
since this release
Form elements have been revamped and aligned with the most recent form element documentation at Primer Style.
Deprecated
For all listed deprecations below: existing syntax will keep working, but log warnings will inform about the deprecation.
form_group
is replaced byform_control
(andis_form_group
is replaced byis_form_control
). When updating your code:- You may need to add styling to correct the missing whitespace at top and bottom, because class "form-group" (which is also added when using attrs
form_group
andis_form_group
) contains a top and bottom margin. - Without a form group, text inputs (as well as selects) will be given a default width by the browser and will probably be displayed smaller than they currently are.
- You may need to add styling to correct the missing whitespace at top and bottom, because class "form-group" (which is also added when using attrs
- The horizontal "tab-row" layout of
radio_group
is not mentioned in the Primer Design specification, while "Radio group" is (with vertical layout).- The current
radio_group
has been renamed toradio_tabs
. - The new component
radio_group
uses a vertical layout.
- The current
checkbox
andradio_button
slothint
has been renamed tocaption
.button_group
slotbutton
is replaced bybutton
components as children.- For consistency, attr
is_full
has been renamed tois_full_width
(inalert
andheader
slot:item
).
Improvements
- Added component
checkbox_group
. - Added convenience component
checkbox_in_group
for checkboxes inside acheckbox_group
. - Added component
radio_group
(with vertical layout). - Added attr
caption
to show hint message below the form fields.- Implemented for
select
,text_input
andtextarea
. - Implemented for
checkbox_group
andradio_group
to show a hint below the group label.
- Implemented for
- Added a required marker to
form_control
,checkbox_group
andradio_group
. The form control label will show a required marker if the field is required.- Added
is_required?
toFieldState
, so it can also be queried invalidation_message
andcaption
callbacks.
- Added
- Added disabled state to
form_control
:- With components
select
,text_input
andtextarea
: the attributedisabled
is automatically passed toform_control
. - When using component
form_control
on its own: set explicitly with attris_disabled
.
- With components
Removed
- Form element width variation attrs
is_short
andis_shorter
. These are no longer supported by Primer System. form_control
classbody
: this extra div is removed to simplify the styling of validation states.