Skip to content
Favorite
This is a help text This is a help text
Boolean icon - Web Component
The BooleanIcon component can be used imported from:
Playground
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:
Name | Type | Description | Slot | A11y |
---|---|---|---|---|
config | string | Icon set to be used as a checkbox. The possible values are: | ||
label | string | Label of the input | label | |
model | boolean | Value of the model | ||
checked | boolean | Overrides the "value" parameter as in the standard | ||
disabled | boolean | Blocks the interaction with the input component. | ||
required | boolean | Marks the input component as required. | ||
name | string | Identification for the field inside the form | ||
help-text | string | The forced message to be shown under the input | help-text | |
invalid | boolean | The forced state for set the input as invalid |
Common API
For the basics, check the common specifications.
Events
This component has events. Check the documentation about how to use the events.
Name | Payload | Description |
---|---|---|
change | boolean | Returns the new value of the "value" attribute |
restarted | void | Emitted on value reset |
Slots
This component has slots. Check the documentation about how to use the slots.
Name | Tags | Description |
---|---|---|
label | span | Label for the input |
help-text | span | Help message |
Parameters use
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.
The slot label
can also be used:
model
Both model
and checked
parameters are used to set the value of the component.
name
The attribute name
will set the name of the component. This is useful when the component is part of a form.
help-text
The help-text
attribute will provide a text if a label
is used:
We can also use the help-text
slot:
Flags
disabled
The attribute disabled
will block the interaction with the component.
And with label:
required
The attribute required
will set the component as required.
invalid
The invalid
attribute will set the component as invalid. If a label is present a default text will be shown unless is overwritten using help-text
Methods
reset()
We can all the reset()
method of the WebComponent in order to reset the value. This will clean the internal states and emit the nullable value with the change
event, plus a restarted
event:
In this example, the button triggers the method:
Value:
false
Browser support
Detected engine:
Chromium
Webkit
Gecko