Input
Form component used for inputting data directly from the keyboard.
Example
<i-input v-model="value" placeholder="Type something.." />
export default {
data () {
return {
value: ''
};
}
}
Value:
Disabled State
<i-input v-model="value" placeholder="Type something.." disabled />
export default {
data () {
return {
value: ''
};
}
}
Readonly State
<i-input v-model="value" placeholder="Type something.." readonly />
export default {
data () {
return {
value: ''
};
}
}
Clearable Input
<i-input v-model="value" placeholder="Type something.." clearable />
export default {
data () {
return {
value: ''
};
}
}
Prefix and Suffix
Inkline allows you to easily add a prefix or suffix to your inputs. Using prefixes and suffixes you can, indicate your input type using an icon or text.
<i-input v-model="value" placeholder="Type something..">
<i slot="prefix">@</i>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<i slot="suffix">@</i>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<i slot="prefix">@</i>
<i slot="suffix">@</i>
</i-input>
export default {
data () {
return {
value: ''
};
}
}
Prepend and Append
You can add additional content such as select fields, buttons or plain text, to either side of the input by using the prepend and append slots.
<i-input v-model="value" placeholder="Type something..">
<span slot="prepend">http://</span>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<span slot="append">.com</span>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<span slot="prepend">http://</span>
<span slot="append">.com</span>
</i-input>
export default {
data () {
return {
value: ''
};
}
}
<i-input v-model="value" placeholder="Type something..">
<i-button slot="prepend">Button</i-button>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<i-button slot="append">Button</i-button>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<i-button slot="prepend">Button</i-button>
<i-button slot="append">Button</i-button>
</i-input>
export default {
data () {
return {
value: ''
};
}
}
<i-input v-model="value" placeholder="Type something..">
<i-dropdown slot="prepend">
<i-button>Dropdown</i-button>
<i-dropdown-menu>
<i-dropdown-item href>Action</i-dropdown-item>
<i-dropdown-item href>Another action</i-dropdown-item>
<i-dropdown-item href disabled>Something disabled here</i-dropdown-item>
<i-dropdown-divider />
<i-dropdown-item>Separated item</i-dropdown-item>
</i-dropdown-menu>
</i-dropdown>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<i-dropdown slot="append">
<i-button>Dropdown</i-button>
<i-dropdown-menu>
<i-dropdown-item href>Action</i-dropdown-item>
<i-dropdown-item href>Another action</i-dropdown-item>
<i-dropdown-item href disabled>Something disabled here</i-dropdown-item>
<i-dropdown-divider />
<i-dropdown-item>Separated item</i-dropdown-item>
</i-dropdown-menu>
</i-dropdown>
</i-input>
<i-input v-model="value" placeholder="Type something..">
<i-dropdown slot="prepend">
<i-button>Dropdown</i-button>
<i-dropdown-menu>
<i-dropdown-item href>Action</i-dropdown-item>
<i-dropdown-item href>Another action</i-dropdown-item>
<i-dropdown-item href disabled>Something disabled here</i-dropdown-item>
<i-dropdown-divider />
<i-dropdown-item>Separated item</i-dropdown-item>
</i-dropdown-menu>
</i-dropdown>
<i-dropdown slot="append">
<i-button>Dropdown</i-button>
<i-dropdown-menu>
<i-dropdown-item href>Action</i-dropdown-item>
<i-dropdown-item href>Another action</i-dropdown-item>
<i-dropdown-item href disabled>Something disabled here</i-dropdown-item>
<i-dropdown-divider />
<i-dropdown-item>Separated item</i-dropdown-item>
</i-dropdown-menu>
</i-dropdown>
</i-input>
export default {
data () {
return {
value: ''
};
}
}
Sizes
You're able to use the size
modifier to control the size of your inputs, using one of the available sizes: sm
, md
, and lg
. The default size is set to md
.
<i-input size="sm" v-model="value" placeholder="Type something small.." />
<i-input size="md" v-model="value" placeholder="Type something medium.." />
<i-input size="lg" v-model="value" placeholder="Type something large.." />
export default {
data () {
return {
value: ''
};
}
}
Types
Behind the scenes, Inkline uses a native HTML <input>
element, meaning that you can use the type
property to define the type of the input, such as text
, password
, date
, email
, and so on.
<i-input type="password" v-model="value" placeholder="Enter your password.." />
export default {
data () {
return {
value: ''
};
}
}
Component API
Here you can find a list of the various customization options you can use for the input component as props, as well as available slots and events.
Boolean
true
, false
false
Boolean
true
, false
false
String
Boolean
true
, false
false
Object
String
sm
, md
, lg
md
String
text
, password
text
String
v-model
directive.(event: Event) => {}
(event: Event) => {}
(event: Event) => {}
(value: String) => {}
(value: String) => {}
(value: String) => {}
(value: String) => {}
Sass Variables
Here you can find a list of the Sass variables you can use for the input components. If you're looking to find common variables that these rely on, you should take a look at the Sass Variables page.
0.5rem
$line-height
spacers('1/2') spacers('1')
size-map($input-padding-base, $sizes, $size-multipliers)
nth($input-padding-base, 2) * 4
size-map($input-prefix-padding-base, $sizes, $size-multipliers)
1px
$font-size
$body-color-light
$input-color-light
$input-color-light
colors('gray-60')
$input-color-light
$color-white
colors('gray-20')
$input-background-light
$border-color-light
darken-lightness($input-border-color-light, 10%)
$color-primary
$color-light
$color-primary
$color-dark
$input-icon-circle-color-light
$color-light
$body-color-dark
$input-color-dark
$input-color-dark
colors('gray-40')
$input-color-dark
darken($color-dark, 3%)
$color-gray-70
$input-background-dark
$border-color-dark
lighten-lightness($input-border-color-dark, 10%)
$color-primary
$color-dark
$color-primary
$color-white
$input-icon-circle-color-dark
$color-dark
$border-width
$border-radius
inset 0 1px 1px rgba($color-black, 0.05)
background-color $transition-duration $transition-easing, color $transition-duration $transition-easing, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out
1.2rem
$color-for-light-variant
$color-for-dark-variant
input-variant($color-{variant})
(
light: $input-variant-light,
dark: $input-variant-dark
)
@function input-variant($variant) {
$input-color: variant-color-by-luminance($variant, $input-color-for-light-variant, $input-color-for-dark-variant);
$input-color-focus: $input-color;
$input-color-disabled: $input-color;
$input-plaintext-color: $input-color;
$input-placeholder-color: variant-color-by-luminance($variant, $color-gray-60, $color-gray-40);
$input-background: $variant;
$input-background-focus: $input-background;
$input-background-disabled: variant-color-by-luminance($variant, $color-gray-20, $color-gray-70);
$input-border-color: variant-color-by-luminance($variant, $border-color-light, $border-color-dark);
$input-border-color-hover: variant-color-by-luminance($variant, darken-lightness($input-border-color, 10%), lighten-lightness($input-border-color, 10%));
$input-border-color-focus: $color-primary;
$input-icon-circle-background: variant-color-by-luminance($variant, $color-light, $color-dark);
$input-icon-circle-background-hover: $color-primary;
$input-icon-circle-color: variant-color-by-luminance($variant, $input-color-for-dark-variant, $input-color-for-light-variant);
$input-icon-circle-color-hover: $input-icon-circle-color;
$input-append-prepend-background: variant-color-by-luminance($variant, $color-light, $color-dark);
$variant-map: (
'color': $input-color,
'color-focus': $input-color-focus,
'color-disabled': $input-color-disabled,
'placeholder-color': $input-placeholder-color,
'plaintext-color': $input-plaintext-color,
'background': $input-background,
'background-disabled': $input-background-disabled,
'background-focus': $input-background-focus,
'border-color': $input-border-color,
'border-color-hover': $input-border-color-hover,
'border-color-focus': $input-border-color-focus,
'icon-circle-background': $input-icon-circle-background,
'icon-circle-background-hover': $input-icon-circle-background-hover,
'icon-circle-color': $input-icon-circle-color,
'icon-circle-color-hover': $input-icon-circle-color-hover,
'append-prepend-background': $input-append-prepend-background,
);
@return $variant-map;
}