Chip
On this page
Importing
Add rh-chip to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-chip/rh-chip.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Usage
<rh-chip>Chip</rh-chip>
<script type="module">
import '@rhds/elements/rh-chip/rh-chip.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
Importing chip vs. chip group
If using <rh-chip-group>, change the import from rh-chip.js to rh-chip-group.js:
- import '@rhds/elements/rh-chip/rh-chip.js';
+ import '@rhds/elements/rh-chip/rh-chip-group.js';
Users can import rh-chip-group.js to gain access to both elements. If you're only using chip, save some bytes by only importing rh-chip.js.
rh-chip
A chip is used to filter information or indicate that a selection was made.
Slots
1
| Slot Name | Summary | Description |
|---|---|---|
[default]
|
The label of the checkbox |
Attributes
3
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
checked
|
checked |
Whether the chip is checked. |
|
|
disabled
|
disabled |
Whether the chip is disabled. |
|
|
value
|
value |
Set a custom string for the input's |
|
|
Methods
0
None
Events
1
| Event Name | Description |
|---|---|
chip-checked
|
when chip is checked/unchecked |
CSS Shadow Parts
1
| Part Name | Summary | Description |
|---|---|---|
chip
|
The main chip container |
CSS Custom Properties
0
None
Design Tokens
23
| Token | Description | Copy |
|---|---|---|
--rh-space-lg
|
16px spacer |
|
--rh-font-family-body-text
|
Body text font family |
|
--rh-line-height-body-text
|
Line height for body text |
|
--rh-border-radius-pill
|
Pill border radius; Example: Label |
|
--rh-border-width-sm
|
1px border width; Example: Secondary CTA or Button |
|
--rh-color-border-subtle
|
|
|
--rh-space-xs
|
4px spacer |
|
--rh-font-size-body-text-sm
|
14px font size |
|
--rh-font-size-body-text-xs
|
12px font size |
|
--rh-border-radius-default
|
3px border radius; Example: Card |
|
--rh-length-3xs
|
2px length token |
|
--rh-length-md
|
8px length token |
|
--rh-border-width-md
|
2px border width: Example: Alert |
|
--rh-color-border-interactive
|
|
|
--rh-color-text-secondary
|
|
|
--rh-color-gray-40
|
Subtle icon (hover state) |
|
--rh-color-gray-30
|
Subtle borders (light theme) |
|
--rh-color-surface-dark
|
Tertiary surface (dark theme) |
|
--rh-color-blue-70
|
Alert - Info title text |
|
--rh-color-blue-10
|
Alert - Info background |
|
--rh-color-blue-30
|
Inline link (dark theme) |
|
--rh-color-blue-50
|
Label - Filled (Blue) accent color |
|
--rh-space-md
|
8px spacer |
|
rh-chip-group
Chip Group
Slots
3
| Slot Name | Summary | Description |
|---|---|---|
accessible-label
|
An accessible label for the chip group.
Content for this slot is put into the |
|
[default]
|
Place individual |
|
clear-all
|
Customized text for the "Clear all" button |
Attributes
2
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
size
|
size |
Decreases the font-size of the chip's label |
|
|
accessible-label
|
accessibleLabel |
The accessible label for the form control / |
|
|
Methods
1
| Method Name | Description |
|---|---|
firstUpdated()
|
Events
0
None
CSS Shadow Parts
1
| Part Name | Summary | Description |
|---|---|---|
legend
|
CSS Custom Properties
0
None
Design Tokens
18
| Token | Description | Copy |
|---|---|---|
--rh-space-lg
|
16px spacer |
|
--rh-font-size-body-text-md
|
16px font size |
|
--rh-border-radius-pill
|
Pill border radius; Example: Label |
|
--rh-color-interactive-primary-default
|
|
|
--rh-font-family-body-text
|
Body text font family |
|
--rh-line-height-body-text
|
Line height for body text |
|
--rh-border-width-sm
|
1px border width; Example: Secondary CTA or Button |
|
--rh-space-xs
|
4px spacer |
|
--rh-space-md
|
8px spacer |
|
--rh-color-interactive-primary-hover
|
|
|
--rh-color-border-subtle
|
|
|
--rh-border-radius-default
|
3px border radius; Example: Card |
|
--rh-length-4xs
|
1px length token |
|
--rh-length-md
|
8px length token |
|
--rh-border-width-md
|
2px border width: Example: Alert |
|
--rh-color-border-interactive
|
|
|
--rh-font-size-body-text-sm
|
14px font size |
|
--rh-font-size-body-text-xs
|
12px font size |
|
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.