You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
<spanclass="mdc-chip__text">Add to calendar</span>
89
-
</button>
97
+
<spanrole="gridcell">
98
+
<spanrole="button"tabindex="0"class="mdc-chip__text">Add to calendar</span>
99
+
</span>
100
+
</div>
90
101
```
91
102
92
103
#### Trailing icon
93
104
94
105
A trailing icon comes with the functionality to remove the chip from the set. If you're adding a trailing icon, also set `tabindex="0"` and `role="button"` to make it accessible by keyboard and screenreader. Trailing icons should only be added to [input chips](#input-chips).
Choice chips are a variant of chips which allow single selection from a set of options. To define a set of chips as choice chips, add the class `mdc-chip-set--choice` to the chip set element.
@@ -115,15 +130,17 @@ Choice chips are a variant of chips which allow single selection from a set of o
115
130
Filter chips are a variant of chips which allow multiple selection from a set of options. To define a set of chips as filter chips, add the class `mdc-chip-set--filter` to the chip set element. When a filter chip is selected, a checkmark appears as the leading icon. If the chip already has a leading icon, the checkmark replaces it. This requires the HTML structure of a filter chip to differ from other chips:
@@ -152,7 +171,7 @@ To use a leading icon in a filter chip, put the `mdc-chip__icon--leading` elemen
152
171
Input chips are a variant of chips which enable user input by converting text into chips. To define a set of chips as input chips, add the class `mdc-chip-set--input` to the chip set element.
<spanrole="radio"tabindex="0"aria-checked="true"class="mdc-chip__text">Add to calendar</span>
220
+
</span>
221
+
</div>
222
+
</div>
200
223
```
201
224
202
225
To pre-select filter chips that have a leading icon, also add the class `mdc-chip__icon--leading-hidden` to the `mdc-chip__icon--leading` element. This will ensure that the checkmark displaces the leading icon.
`hasLeadingIcon() => boolean` | Returns whether the chip has a leading icon
338
373
`getRootBoundingClientRect() => ClientRect` | Returns the bounding client rect of the root element
339
374
`getCheckmarkBoundingClientRect() => ClientRect \| null` | Returns the bounding client rect of the checkmark element or null if it doesn't exist
340
-
`setAttr(attr: string, value: string) => void` | Sets the value of the attribute on the root element.
375
+
`notifyNavigation(key: string, source: EventSource) => void` | Notifies the Chip Set that a navigation event has occurred
376
+
`setPrimaryActionAttr(attr: string, value: string) => void` | Sets an attribute on the primary action element to the given value
377
+
`focusPrimaryAction() => void` | Gives focus to the primary action element
378
+
`hasTrailingAction() => boolean` | Returns `true` if the chip has a trailing action element
379
+
`setTrailingActionAttr(attr: string, value: string) => void` | Sets an attribute on the trailing action element to the given value, if the element exists
380
+
`focusTrailingAction() => void` | Gives focus to the trailing action element if present
381
+
341
382
342
383
> \*_NOTE_: `notifyInteraction` and `notifyTrailingIconInteraction` must pass along the target chip's ID, and must be observable by the parent `mdc-chip-set` element (e.g. via DOM event bubbling).
0 commit comments