Checkbox
Use select boxes to allow users to select more than one option from a small group, or for opt in/out question. View this component on GitHub
Contents
- Basic
- Multiple
- Right justified
- Accessibility
- Props
- Events
- Methods
- CSS Shadow Parts
- CSS Custom Properties
- Slots
Basic
Checkboxes are mainly used for more than one option. A single checkbox may be applied to enable selection inside another compoennt such as a row in a table, or in a card.
<admiralty-checkbox label-text="I agree"></admiralty-checkbox>
<admiralty-checkbox label-text="I agree"></admiralty-checkbox>
<AdmiraltyCheckbox label-text="I agree"></AdmiraltyCheckbox>
Multiple
Use select boxes to allow users to select more than one option.
<div style="display: flex; flex-direction: column">
<admiralty-checkbox name="2023-checkbox" label-text="2023"></admiralty-checkbox>
<admiralty-checkbox name="2022-checkbox" label-text="2022" checked="true"></admiralty-checkbox>
<admiralty-checkbox name="2021-checkbox" label-text="2021"></admiralty-checkbox>
</div>
<div style="display: flex; flex-direction: column">
<admiralty-checkbox name="2023-checkbox" label-text="2023"></admiralty-checkbox>
<admiralty-checkbox name="2022-checkbox" label-text="2022" checked="true"></admiralty-checkbox>
<admiralty-checkbox name="2021-checkbox" label-text="2021"></admiralty-checkbox>
</div>
<div style={{ display: "flex", flexDirection: "column" }}>
<AdmiraltyCheckbox name="2023-checkbox" label-text="2023"></AdmiraltyCheckbox>
<AdmiraltyCheckbox name="2022-checkbox" label-text="2022" checked={true}></AdmiraltyCheckbox>
<AdmiraltyCheckbox name="2021-checkbox" label-text="2021"></AdmiraltyCheckbox>
</div>
Right justified
To introduce the checkbox selection, used in our filter pattern for example.
<admiralty-checkbox label-text="I agree" checkbox-right="true"></admiralty-checkbox>
<admiralty-checkbox label-text="I agree" checkbox-right="true"></admiralty-checkbox>
<AdmiraltyCheckbox label-text="I agree" checkbox-right={true}></AdmiraltyCheckbox>
Accessibility
Built to enable keyboard navigation, ensure users can easily select a checkbox and labelling is clear.
Props
checkbox-rightbooleanfalsecheckedbooleanfalsetrue, the checkbox is selected.disabledbooleanfalselabel-hiddenbooleanfalselabel-textstringnulllabelHidden property to control its visibility.namestringthis.inputIdvalueanyundefinedchecked property for that. The value of a checkbox is analogous to the value of an <input type="checkbox">, it's only used when the checkbox participates in a native <form>.Events
admiraltyChangecheckboxBlurcheckboxFocusMethods
No public methods available for this component.
CSS Shadow Parts
No CSS shadow parts available for this component.
CSS Custom Properties
--admiralty-checkbox-font-size--admiralty-checkbox-font-weight--admiralty-checkbox-input-margin--admiralty-checkbox-input-padding--admiralty-checkbox-label-alignment-padding-left--admiralty-checkbox-label-alignment-padding-right--admiralty-checkbox-label-margin-bottom--admiralty-checkbox-label-padding-leftSlots
No slots available for this component.