Skip to content

Listboxes Config Module

The Listboxes Config Module holds your application's default/prototypal Tailwind CSS classes for Listbox components 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 Listboxes 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:

javascript
// ./src/app.vv.ts

import { VvConfig } from '@obewds/vueventus'
import type { ConfigVv } from '@obewds/vueventus'

let appVv: ConfigVv = VvConfig

appVv.listboxes.someProperty = 'some-value'

// ...

export default appVv

Import

However, if you need to import the compiled library version of the Listboxes Config Module, you can use:

javascript
import { Listboxes } from '@obewds/vueventus'

Listboxes.border

Type: String
Default: "border"

The Listboxes.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

javascript
// ./src/app.vv.ts
appVv.listboxes.border = '...'

Listboxes.display

Type: String
Default: "block w-full"

The Listboxes.display parameter is meant to isolate the CSS display/block level characteristics and requirements for an application's listbox 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

javascript
// ./src/app.vv.ts
appVv.listboxes.display = '...'

Listboxes.outline

Type: String
Default: ""

The Listboxes.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

javascript
// ./src/app.vv.ts
appVv.listboxes.outline = '...'

Listboxes.ring

Type: String
Default: ""

The Listboxes.ring parameter is meant to isolate the Tailwind CSS ring visualization interaction characteristics and requirements for an application's listbox 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

javascript
// ./src/app.vv.ts
appVv.listboxes.ring = '...'

Listboxes.rounding

Type: String
Default: ""

The Listboxes.rounding parameter is meant to isolate the Tailwind CSS border rounding characteristics and requirements for an application's listbox 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

javascript
// ./src/app.vv.ts
appVv.listboxes.rounding = '...'

Listboxes.shadow

Type: String
Default: ""

The Listboxes.shadow parameter is meant to isolate the Tailwind CSS border shadow characteristics and requirements for an application's listbox 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

javascript
// ./src/app.vv.ts
appVv.listboxes.shadow = '...'

Listboxes.sizes

Type: Object

Listboxes.sizes PropertiesListboxes.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

javascript
// ./src/app.vv.ts
appVv.listboxes.sizes = {
     'xs': '',
     'sm': '',
     'md': '',
     'lg': '',
     'xl': '',
    '2xl': '',
}
javascript
// ./src/app.vv.ts
appVv.listboxes.sizes['xs']  = ''
appVv.listboxes.sizes['sm']  = ''
appVv.listboxes.sizes['md']  = ''
appVv.listboxes.sizes['lg']  = ''
appVv.listboxes.sizes['xl']  = ''
appVv.listboxes.sizes['2xl'] = ''

Listboxes.text

Type: String
Default: ""

The Listboxes.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

javascript
// ./src/app.vv.ts
appVv.listboxes.text = '...'

Listboxes.transition

Type: String
Default: "transition-colors ease-in-out duration-300"

The Listboxes.transition parameter is meant to isolate the transition/animation characteristics and requirements for an application's listbox elements.

Example

javascript
// ./src/app.vv.ts
appVv.listboxes.transition = '...'

Listboxes.base()

Returns: String
Default: "border block w-full transition-colors ease-in-out duration-300"

The Listboxes.base() method returns a joined String of the atomic classes within the various base properties of the Listboxes Config Module object.

Example

html
<!-- ./src/components/SomeComponent.vue -->

<script setup lang="ts">

    import appVv from '../app.vv'
    
</script>

<template>

    <button :class="appVv.listboxes.base()">
        Faux Listbox
    </button>

</template>

Listboxes.classes()

Returns: String
Default: "border block w-full transition-colors ease-in-out duration-300 px-3 py-2 text-lg"

The Listboxes.classes() method returns a joined String of the atomic classes within the various base properties of the Listboxes Config Module object using the Listboxes.base() method under the hood.

However, the Listboxes.classes() method also returns Listboxes.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

ArgsTypeStatusDescription
sizesKeyStringOptionalProperty name/key of an Listboxes.sizes object

The applicable values for the sizesKey argument are set via the Listboxes.sizes property names/keys and atomic class values.

Examples

html
<!-- ./src/components/SomeComponent.vue -->

<script setup lang="ts">

    import appVv from '../app.vv'
    
</script>

<template>

    <button :class="appVv.listboxes.classes()">
        Faux Listbox
    </button>

    <button :class="appVv.listboxes.classes('lg')">
        Large Faux Listbox
    </button>

</template>

Listboxes.getSizeClasses()

Returns: String
Default: "px-3 py-2 text-lg"

The Listboxes.getSizeClasses() method returns text size related classes based on the optional argument value passed into the method. These size related classes come from the Listboxes.sizes object property names/keys and values (of atomic classes).

Arguments

ArgsTypeStatusDescription
sizesKeyStringOptionalProperty name/key of an Listboxes.sizes object

The applicable values for the sizesKey argument are set via the Listboxes.sizes property names/keys and atomic class values.

Examples

html
<!-- ./src/components/SomeComponent.vue -->

<script setup lang="ts">

    import appVv from '../app.vv'
    
</script>

<template>

    <button :class="appVv.listboxes.getSizeClasses()">
        Faux Listbox
    </button>

    <button :class="appVv.listboxes.getSizeClasses('lg')">
        Large Faux Listbox
    </button>

</template>

Module Code

ts
// ./src/configs/Listboxes.ts

import type { ConfigListboxes } from '../types/ConfigListboxes'
import Transitions from './Transitions.js'

export default <ConfigListboxes>{
    border: 'border',
    display: 'block w-full',
    outline: '',
    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()
    },
}

Released under the MIT License