1.0.7 • Published 4 years ago
@psff/cmp-input v1.0.7
@psff/cmp-input psff-input
Component to show inputs.
Getting started
Setup the package as a dependencie.
yarn add @psff/cmp-input
Use the component
<psff-input />
.import PsffInput from '@psff/cmp-input' @Component({ components: { 'psff-input': PsffInput, }, }) export default class MyComponent extends Vue {}
.my-input { --psff-input-background-color: #fabada; --psff-input-label-color: black; }
<psff-input class="my-input" label="Email" type="email" placeholder="ex. kay.mcnulty@upenn.edu" />
Specifications
Component <psff-input />
This component render an input.
Slots
input-prefix
: place before text content inside the field. (for a simple string, can be given as a prop)input-suffix
: place after text content inside the field. (for a simple string, can be given as a prop)input-before
: place horizontally right before the input and aligned with the field.input-after
: place horizontally right after the input and aligned with the field.
Parameters:
Extend <input>
tag parameters with:
label
(string, optional): to show a label for the input.maxlenght
(number, optional): The maximum length of the input value.disabled
(boolean, default: false): If the input is available for user interaction.prefix
(string, optional): A string to show before the input value.suffix
(string, optional): A string to show after the input value.placeholder
(string, optional): The input placeholder.errorMessage
(string, optional): 'right')*: to show an error message.
Events
blur
(value: string): user leave the field.change
(value: string): new value after user interaction.focus
(value: string): user just enters the field.input
(value: string): every time the value changes.keydown
(value: string): when the user press a key and before value changes (can be prevented).
Custom propperties:
Generic:
--psff-input-label-color
(default #5e88fc)--psff-input-label-font-family
(default inherit)--psff-input-label-font-size
(default inherit)--psff-input-label-font-weight
(default inherit)--psff-input-label-line-height
(default inherit)--psff-input-label-margin-bottom
(default 4px)--psff-input-background-color
(default #fff)--psff-input-border-color
(default #b8cbfd)--psff-input-border-color-error
(default #ffc0b9)--psff-input-border-radius
(default 4px)--psff-input-border-size
(default 1px)--psff-input-box-shadow
(default 2px 2px 4px rgba(94, 136, 252, .1))--psff-input-color
(default #313131)--psff-input-font-family
(default inherit)--psff-input-font-size
(default inherit)--psff-input-font-weight
(default inherit)--psff-input-line-height
(default inherit)--psff-input-error-color
(default #fb5f4f)--psff-input-error-font-family
(default inherit)--psff-input-padding
(default 16px)--psff-input-placeholder-color
(default none)--psff-input-prefix-color
(default --psff-input-color)--psff-input-prefix-font-family
(default --psff-input-font-family)--psff-input-prefix-font-size
(default --psff-input-font-size)--psff-input-prefix-font-weight
(default --psff-input-font-weight)--psff-input-prefix-line-height
(default --psff-input-line-height)--psff-input-prefix-margin
(default 16px)--psff-input-width
(default 100%)Disabled:
--psff-input-label-color-disabled
(default #848484)--psff-input-background-color-disabled
(default #ede9e5)--psff-input-border-color-disabled
(default #afaeaf)--psff-input-color-disabled
(default #afaeaf)On focused:
--psff-input-border-color-focused
(default #5e88fc)--psff-input-border-size-focused
(default --psff-input-border-size)--psff-input-border-color-error-focused
(default #fb5f4f)