ChipView
Displays an inline series of Chips which may be navigated to, selected and deleted. You can provide a closeHandler to decide what should happen when a chip is closed. If not provided, by default the record representing the chip is removed from the store.
//<code-header>
fiddle.title = 'Chip view';
//</code-header>
new SlideToggle({
insertFirst : targetElement,
label : 'Show close icon',
checked : true,
onChange({ value }) {
chipView.closable = value;
}
});
// checkbox with default look
const chipView = new ChipView({
appendTo : targetElement,
style : 'display:flex;gap:.5em',
items : [
'Coke',
'Pepsi',
'Water',
'Fanta',
'Fernet'
]
});Configs
96
Configs
96Common
Other
Configure as true to display a clickable close icon after the itemTpl.
When tapped, the configured closeHandler is called passing the associated record.
Chips may also be selected using the LEFT and RIGHT arrows (And the Shift key to do multiple,
contiguous selection). Pressing the DELETE or BACKSPACE key passes the selected records to the
closeHandler (if not provided, the record representing the chip is removed from the store).
If closable is true, this is the name of a callback function to handle what the "close"
action means. If not provided, the record representing the chip is removed from the store.
A template function, which, when passed a record, returns the markup which encapsulates a chip's icon to be placed before the itemTpl.
| Parameter | Type | Description |
|---|---|---|
record | Model | The record to provide an icon for |
Configure as true to allow multi select and allow clicking and key navigation to select multiple chips.
DOM
Float & align
Layout
Misc
Scrolling
Properties
78
Properties
78Class hierarchy
CSS
DOM
Layout
Misc
Other
Functions
65
Functions
65Configuration
Events
Misc
Other
Widget hierarchy
Events
19
Events
19Event handlers
19
Event handlers
19Typedefs
6
Typedefs
6CSS variables
55
CSS variables
55| Name | Description |
|---|---|
--b-chip-view-gap | Gap between chips |
--b-chip-view-padding | Padding of the chip view |
--b-chip-view-chip-border-radius | Chip border radius |
--b-chip-view-chip-border-width | Chip border width |
--b-chip-view-chip-font-size | Chip font size |
--b-chip-view-chip-gap | Gap between chip content (chip's inner gap) |
--b-chip-view-chip-padding-block | Chip padding block |
--b-chip-view-chip-padding-inline | Chip padding inline |
--b-chip-view-chip-border-color | Chip border color |
--b-chip-view-chip-color | Chip text color |
--b-chip-view-chip-background | Chip background |
| Active | |
--b-chip-view-chip-active-background | Active chip background |
--b-chip-view-chip-active-selected-background | Active selected chip background |
| Focused | |
--b-chip-view-chip-focus-border-color | Focused chip border color |
| Hovered | |
--b-chip-view-chip-hover-background | Hovered chip background |
| Selected | |
--b-chip-view-chip-selected-color | Selected (and active) chip text color |
--b-chip-view-chip-selected-background | Selected chip background |