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.

Chip view
//<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

Common

listenersEvents

Other

closable: Boolean= true

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).

closeHandler: String | function

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.

Returns: void
iconTpl: function

A template function, which, when passed a record, returns the markup which encapsulates a chip's icon to be placed before the itemTpl.

ParameterTypeDescription
recordModel

The record to provide an icon for

Returns: DomConfig | String | null
multiSelect: Boolean= false

Configure as true to allow multi select and allow clicking and key navigation to select multiple chips.

columnWidget
itemsList
rtlRTL
spanWidget
storeList
titleList

Accessibility

ariaLabelWidget
keyMapKeyMap

CSS

clsWidget
colorWidget
htmlClsWidget
styleWidget
uiWidget

DOM

adoptWidget
appendToWidget
contentWidget
datasetWidget
htmlWidget
idWidget
tagWidget

Float & align

alignWidget
anchorWidget
centeredWidget
draggableWidget
floatingWidget
xWidget
yWidget

Layout

alignSelfWidget
dockWidget
flexWidget
heightWidget
hiddenWidget
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
textAlignWidget
weightWidget
widthWidget

Misc

dataFieldWidget
disabledWidget
localeClassLocalizable
localizableLocalizable
maskedWidget
ownerWidget
readOnlyWidget
refWidget
rippleWidget
tabWidget
tooltipWidget

Scrolling

Properties

78

Class hierarchy

isChipView: Boolean= truereadonly
Identifies an object as an instance of ChipView class, or subclass thereof.
isChipView: Boolean= truereadonlystatic
Identifies an object as an instance of ChipView class, or subclass thereof.
isDelayableDelayable
isEventsEvents
isKeyMapKeyMap
isListList
isLocalizableLocalizable
isWidgetWidget

Accessibility

keyMapKeyMap

CSS

clsWidget

DOM

appendToWidget
contentWidget
datasetWidget
elementWidget
htmlWidget
idWidget
styleWidget

Float & align

xWidget
yWidget

Layout

alignSelfWidget
flexWidget
heightWidget
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
widthWidget

Lifecycle

configBase

Misc

cellInfoWidget
disabledWidget
localeHelperLocalizable
localeManagerLocalizable
readOnlyWidget
refWidget
tabWidget
tooltipWidget

Other

$namestaticWidget
columnWidget
countList
itemsList
rtlRTL
spanWidget
storeList
titleList
typestaticWidget

Visibility

hiddenWidget
isVisibleWidget

Widget hierarchy

ownerWidget
parentWidget

Functions

65

Configuration

applyDefaultsstaticBase

Events

Float & align

alignToWidget
setXYWidget
showByWidget
toFrontWidget

Lifecycle

createstaticWidget
destroystaticBase
initClassstaticWidget

Misc

attachTooltipstaticWidget
fromElementstaticWidget
fromSelectorstaticWidget
getByIdstaticWidget
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

composeWidget
createOnFrameDelayable
disableWidget
enableWidget
focusWidget
LstaticLocalizable
maskWidget
onEvents
recomposeWidget
relayAllEvents
triggerEvents
unEvents
unmaskWidget

Selection

selectList

Visibility

hideWidget
showWidget

Widget hierarchy

closestWidget
containsWidget
ownsWidget
queryWidget
queryAllWidget
upWidget

Events

19

Event handlers

19

Typedefs

6

CSS variables

55
NameDescription
--b-chip-view-gapGap between chips
--b-chip-view-paddingPadding of the chip view
--b-chip-view-chip-border-radiusChip border radius
--b-chip-view-chip-border-widthChip border width
--b-chip-view-chip-font-sizeChip font size
--b-chip-view-chip-gapGap between chip content (chip's inner gap)
--b-chip-view-chip-padding-blockChip padding block
--b-chip-view-chip-padding-inlineChip padding inline
--b-chip-view-chip-border-colorChip border color
--b-chip-view-chip-colorChip text color
--b-chip-view-chip-backgroundChip background
Active
--b-chip-view-chip-active-backgroundActive chip background
--b-chip-view-chip-active-selected-backgroundActive selected chip background
Focused
--b-chip-view-chip-focus-border-colorFocused chip border color
Hovered
--b-chip-view-chip-hover-backgroundHovered chip background
Selected
--b-chip-view-chip-selected-colorSelected (and active) chip text color
--b-chip-view-chip-selected-backgroundSelected chip background

Inherited