Corex.PinInput
(Corex v0.1.0-alpha.29)
View Source
Phoenix implementation of Zag.js Pin Input.
Examples
Basic
<.pin_input id="pin" count={4} class="pin-input">
<:label>Code</:label>
</.pin_input>Styling
Use data attributes to target elements:
[data-scope="pin-input"][data-part="root"] {}
[data-scope="pin-input"][data-part="label"] {}
[data-scope="pin-input"][data-part="control"] {}
[data-scope="pin-input"][data-part="input"] {}If you wish to use the default Corex styling, you can use the class pin-input on the component.
This requires to install Mix.Tasks.Corex.Design first and import the component css file.
@import "../corex/main.css";
@import "../corex/tokens/themes/neo/light.css";
@import "../corex/components/pin-input.css";You can then use modifiers
<.pin_input class="pin-input pin-input--accent pin-input--lg" count={4}>
<:label>Code</:label>
</.pin_input>Learn more about modifiers and Corex Design
Summary
Components
Attributes
id(:string)value(:list) - Controlled value (list of single chars). Defaults to[].default_value(:list) - Uncontrolled initial value. Defaults to[].controlled(:boolean) - Defaults tofalse.count(:integer) - Number of input boxes. Defaults to4.disabled(:boolean) - Defaults tofalse.invalid(:boolean) - Defaults tofalse.required(:boolean) - Defaults tofalse.read_only(:boolean) - Defaults tofalse.mask(:boolean) - Defaults tofalse.otp(:boolean) - Defaults tofalse.blur_on_complete(:boolean) - Defaults tofalse.select_on_focus(:boolean) - Defaults tofalse.name(:string) - Defaults tonil.form(:string) - Defaults tonil.dir(:string) - Defaults tonil.Must be one ofnil,"ltr", or"rtl".type(:string) - Defaults to"numeric". Must be one of"alphanumeric","numeric", or"alphabetic".placeholder(:string) - Defaults to"○".on_value_change(:string) - Defaults tonil.on_value_change_client(:string) - Defaults tonil.on_value_complete(:string) - Defaults tonil.- Global attributes are accepted.
Slots
label