Inputs Config Module
The Inputs Config Module holds your application's default/prototypal Tailwind CSS classes for Input elements in your application, excluding color palette classes (see Palette Config Modules for more info about palette modules).
app.vv.ts Use
You'll usually work with the Inputs Config Module after it's already been merged into VueVentus VvConfig data.
Here's what that generally looks like in practice in a real world app context:
// ./src/app.vv.ts
import { VvConfig } from '@obewds/vueventus'
import type { ConfigVv } from '@obewds/vueventus'
let appVv: ConfigVv = VvConfig
appVv.inputs.someProperty = 'some-value'
// ...
export default appVv
Import
However, if you need to import the compiled library version of the Inputs Config Module, you can use:
import { Inputs } from '@obewds/vueventus'
Inputs.border
Type: String
Default: "border"
The Inputs.border
parameter is meant to isolate the border specific atomic classes that don't pertain to already represented characteristics in VueVentus like color, size, etc.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.border = '...'
Inputs.display
Type: String
Default: "block w-full"
The Inputs.display
parameter is meant to isolate the CSS display/block level characteristics and requirements for an application's input elements.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.display = '...'
Inputs.outline
Type: String
Default: ""
The Inputs.outline
parameter is meant to isolate the outline specific atomic classes that don't pertain to already represented characteristics in VueVentus like color, size, etc.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.outline = '...'
Inputs.placeholder
Type: String
Default: "placeholder:opacity-50"
The Inputs.placeholder
parameter is meant to isolate the placeholder specific atomic classes that don't pertain to already represented characteristics in VueVentus like color, size, etc.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.placeholder = '...'
Inputs.ring
Type: String
Default: ""
The Inputs.ring
parameter is meant to isolate the Tailwind CSS ring visualization interaction characteristics and requirements for an application's input elements. Tailwind CSS ring classes for example, are typically used in conjunction with the focus:
modifier for user focus interactions.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.ring = '...'
Inputs.rounding
Type: String
Default: ""
The Inputs.rounding
parameter is meant to isolate the Tailwind CSS border rounding characteristics and requirements for an application's input elements.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.rounding = '...'
Inputs.shadow
Type: String
Default: ""
The Inputs.shadow
parameter is meant to isolate the Tailwind CSS border shadow characteristics and requirements for an application's input elements.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.shadow = '...'
Inputs.sizes
Type: Object
Inputs.sizes Properties | Inputs.sizes Prop Values |
---|---|
"xs" | "px-2 py-1.5 text-sm" |
"sm" | "px-3 py-2 text-base" |
"md" | "px-3 py-2 text-lg" |
"lg" | "px-4 py-3 text-xl" |
"xl" | "px-4 py-3 text-2xl" |
"2xl" | "px-5 py-4 text-3xl" |
Examples
// ./src/app.vv.ts
appVv.inputs.sizes = {
'xs': '',
'sm': '',
'md': '',
'lg': '',
'xl': '',
'2xl': '',
}
// ./src/app.vv.ts
appVv.inputs.sizes['xs'] = ''
appVv.inputs.sizes['sm'] = ''
appVv.inputs.sizes['md'] = ''
appVv.inputs.sizes['lg'] = ''
appVv.inputs.sizes['xl'] = ''
appVv.inputs.sizes['2xl'] = ''
Inputs.text
Type: String
Default: ""
The Inputs.text
parameter is meant to isolate the text orientated characteristics and requirements that don't pertain to already represented characteristics in VueVentus like color, size, etc.
AVOID: COLOR & SIZE
Atomic classes for this property should avoid using classes related to characteristics like color and size, which are already abstracted in VueVentus.
Example
// ./src/app.vv.ts
appVv.inputs.text = '...'
Inputs.transition
Type: String
Default: "transition-colors ease-in-out duration-300"
The Inputs.transition
parameter is meant to isolate the transition/animation characteristics and requirements for an application's input elements.
Example
// ./src/app.vv.ts
appVv.inputs.transition = '...'
Inputs.base()
Returns: String
Default: "border block w-full placeholder:opacity-50 transition-colors ease-in-out duration-300"
The Inputs.base()
method returns a joined String
of the atomic classes within the various base properties of the Inputs Config Module object.
Example
<!-- ./src/components/SomeComponent.vue -->
<script setup lang="ts">
import appVv from '../app.vv'
</script>
<template>
<input :class="appVv.inputs.base()"/>
</template>
Inputs.classes()
Returns: String
Default: "border block w-full placeholder:opacity-50 transition-colors ease-in-out duration-300 px-3 py-2 text-lg"
The Inputs.classes()
method returns a joined String
of the atomic classes within the various base properties of the Inputs Config Module object using the Inputs.base()
method under the hood.
However, the Inputs.classes()
method also returns Inputs.getSizeClasses()
method classes in addition to the base property classes/values, which augments the returned value based on the optional argument value passed into the method.
Arguments
Args | Type | Status | Description |
---|---|---|---|
sizesKey | String | Optional | Property name/key of an Inputs.sizes object |
The applicable values for the sizesKey
argument are set via the Inputs.sizes property names/keys and atomic class values.
Examples
<!-- ./src/components/SomeComponent.vue -->
<script setup lang="ts">
import appVv from '../app.vv'
</script>
<template>
<input placeholder="Regular Sized Input" :class="appVv.inputs.classes()"/>
<input placeholder="Large Sized Input" :class="appVv.inputs.classes('lg')"/>
</template>
Inputs.getSizeClasses()
Returns: String
Default: "px-3 py-2 text-lg"
The Inputs.getSizeClasses()
method returns text size related classes based on the optional argument value passed into the method. These size related classes come from the Inputs.sizes
object property names/keys and values (of atomic classes).
Arguments
Args | Type | Status | Description |
---|---|---|---|
sizesKey | String | Optional | Property name/key of an Inputs.sizes object |
The applicable values for the sizesKey
argument are set via the Inputs.sizes property names/keys and atomic class values.
Examples
<!-- ./src/components/SomeComponent.vue -->
<script setup lang="ts">
import appVv from '../app.vv'
</script>
<template>
<input placeholder="Regular Sized Input" :class="appVv.inputs.getSizeClasses()"/>
<input placeholder="Large Sized Input" :class="appVv.inputs.getSizeClasses('lg')"/>
</template>
Module Code
// ./src/configs/Inputs.ts
import type { ConfigInputs } from '../types/ConfigInputs'
import Transitions from './Transitions.js'
export default <ConfigInputs>{
border: 'border',
display: 'block w-full',
outline: '',
placeholder: 'placeholder:opacity-50',
ring: '',
rounding: '',
shadow: '',
text: '',
transition: Transitions.classes('colors', 'inOut', '300'),
base: function () {
return [
this.border,
this.display,
this.outline,
this.placeholder,
this.ring,
this.rounding,
this.shadow,
this.text,
this.transition,
].join(' ').replace(/\s+/g,' ').trim()
},
sizes: {
'xs': 'px-2 py-1.5 text-sm',
'sm': 'px-3 py-2 text-base',
'md': 'px-3 py-2 text-lg',
'lg': 'px-4 py-3 text-xl',
'xl': 'px-4 py-3 text-2xl',
'2xl': 'px-5 py-4 text-3xl',
},
getSizeClasses: function (sizesKey) {
const key = sizesKey && this.sizes[sizesKey] ? sizesKey : 'md'
return this.sizes[key]
},
classes: function (sizesKey) {
const sizes = sizesKey ? sizesKey : ''
return [
this.base(),
this.getSizeClasses(sizes),
].join(' ').replace(/\s+/g,' ').trim()
},
}