Skip to content
Open
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
14 changes: 12 additions & 2 deletions elements/rh-chip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ Chip creates a component that can be used in place of a checkbox.

## Usage

Individual `<rh-chip>`'s are wrapped by an `<rh-chip-group>` element.
Page authors can use `<rh-chip>` individually or alongside several standalone chips.

```html
<rh-chip>Edge</rh-chip>
```

## Chip group

The `<rh-chip-group>` element adds an accessible label for the group and a "clear all" button.

```html
<rh-chip-group>
Expand All @@ -14,4 +22,6 @@ Individual `<rh-chip>`'s are wrapped by an `<rh-chip-group>` element.
</rh-chip-group>
```

See the [official documentation](https://ux.redhat.com/elements/chip/code/) for more customization options.
If using chip group, users must modify the import to reference `rh-chip-group.js`.

See the [official documentation](https://ux.redhat.com/elements/chip/code/) for importing and customization options.
12 changes: 9 additions & 3 deletions elements/rh-chip/docs/00-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
- Indicate to users what selections they made
- Represent a checkbox group with more emphasis

<div id="overview-image-description" class="visually-hidden">
Four chips in a chip group with the words "Filter by" as the legend at the start. The middle two chips are selected with a blue background and corresponding "X". The button to clear all selected chips is on the right.
</div>
## Chip groups

When working with multiple related chips, use a [chip group](/elements/chip/demos/#demo-chip-group).

Chip groups are used to present multiple selectable options that users can toggle on or off, such as filters or preference settings. The chip group element:

- Groups chips together
- Provides an accessible label for the set
- Includes a “clear all” button to reset all selections at once
11 changes: 11 additions & 0 deletions elements/rh-chip/docs/30-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Importing chip vs. chip group

If using `<rh-chip-group>`, change the import from `rh-chip.js` to `rh-chip-group.js`:


```diff rhcodeblock
- 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`.