Password input - Web Component
Browser support
Detected engine:
Chromium
Webkit
Gecko
Parameters
The Web component uses the <z-password-input>
tag:
The parametrization of the component can be done with the following custom HTML params:
Name | Type | Description |
---|---|---|
config | string | The main parameter has two components following the pattern:
|
label | string | Label of the input |
readonly (optional) | boolean | Transforms the input into an output |
value (optional) | string | Value of the model |
disabled (optional) | boolean | Blocks the interaction with the input component. |
required (optional) | boolean | Marks the input component as required. |
name (optional) | string | Identification for the field inside the form |
invalid (optional) | boolean | The forced state for set the input as invalid |
help-text (optional) | string | The forced message to be shown under the input |
The events emitted from the component are:
Name | Payload | Description |
---|---|---|
onchange | string | Returns the new value of the "value" attribute |
onenter | void | Triggered when "Enter" in pressed |
The available slots for the component are:
Name | Tags | Description |
---|---|---|
default | span |
config
The config
parameter is used to set the shape of the input between lined
and shaped
. Being omitted will render the default line
shape.
label
The label
parameter is used to set the text label of the component. Make sure you always use it.
readonly
The readonly
parameter is used to set the input in a read-only state. It's commonly used to display information.
value
The value
parameter is used to set the value for the input.
disabled
The disabled
parameter is used to block the interaction with the component. Not to be confused with readonly
.
required
The required
parameter is used to set the component as required.
name
The name
parameter is used to set the name of the component. This is useful when the component is part of a form.
invalid
The invalid
parameter is used to force the component to be invalid.
help-text
The help-text
parameter is used to provide additional assistance to the user.
Playground
Customization
HTML Examples
Imports
html
<link rel="stylesheet" href="/0.5.0/@zurich/web-components/styles.css" />
<script type="module" src="/0.5.0/@zurich/web-components/password-input.js"></script>
Code
html
<!-- Default -->
<z-password-input label="Password input"></z-password-input>
<z-password-input label="Password input" config="shaped"></z-password-input>
<!-- with value -->
<z-password-input label="Password input" value="password"></z-password-input>
<z-password-input label="Password input" value="password" config="shaped"></z-password-input>
<!-- disabled -->
<z-password-input label="Password input" disabled></z-password-input>
<z-password-input label="Password input" disabled config="shaped"></z-password-input>
<!-- readonly -->
<z-password-input label="Password input" readonly value="password"></z-password-input>
<z-password-input label="Password input" readonly value="password" config="shaped"></z-password-input>
<!-- with help text -->
<z-password-input label="Password input" help-text="Help text"></z-password-input>
<z-password-input label="Password input" help-text="Help text" config="shaped"></z-password-input>
<!-- invalid -->
<z-password-input label="Password input" help-text="Invalid input" invalid></z-password-input>
<z-password-input label="Password input" help-text="Invalid input" invalid config="shaped"></z-password-input>