Skip to content

Boolean icon - Web Component

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

Parameters

The Web component uses the <z-boolean-icon> tag:

By default, all the parameters are optional or can be set in different, except for the ones marked as required

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescriptionSlot
configstring

Icon set to be used as a checkbox. The possible values are: star, heart, bookmark, like, dislike, lock, unlock, mute, unmute, sound-on, sound-off, visible, or invisible

labelstringLabel of the inputlabel
valuebooleanValue of the model
checkedbooleanOverrides the "value" parameter as in the standard
invalid-textstringThe text to be shown when invalidinvalid-text
disabledbooleanBlocks the interaction with the input component.
requiredbooleanMarks the input component as required.
namestringIdentification for the field inside the form

The events emitted from the component are:

NamePayloadDescription
changebooleanReturns the new value of the "value" attribute
restartedvoidEmitted on value reset

The available slots for the component are:

NameTagsDescription
defaultspan

Common API

For the basics, check the common specifications.

config

The config paramater requires the name of the icon set to be used as a checkbox. The possible values are:

star, heart, bookmark, like, dislike, lock, unlock, mute, unmute, sound-on, sound-off, visible or invisible.

label

The z-boolean-icon parameter accepts a label attribute to set the text label of the component.

value & checked

Both value and checked parameters are used to set the value of the component.

disabled

The attribute disabled will block the interaction with the component.

And with label:

required

The attribute required will set the component as required.

name

The attribute name will set the name of the component. This is useful when the component is part of a form.

invalid-text

The invalid-text attribute will set the component as invalid. Without label, the text won't be present but the boolean icon will still be invalid,

The color and the size of the icon can be customized using the --z-boolean-icon--color, --z-boolean-icon--color--off and --z-boolean-icon--size CSS custom properties.

Playground

Customization

HTML Examples

StackBlitz example