Skip to main content
You are viewing Pre-Alpha documentation.
Vuetify0 Logo
Theme
Mode
Accessibility
Vuetify

Sign in

Sign in with your preferred provider to access your account.

useTheme API

API reference for the useTheme composable.

Functions

createTheme

(_options?: ThemeOptions<ThemeRecord>) => R

Creates a new theme instance.

createThemeContext

(_options?: ThemeContextOptions) => ContextTrinity<R>

Creates a new theme context trinity.

createThemePlugin

(_options?: ThemePluginOptions) => any

Creates a new theme plugin.

useTheme

(namespace?: string) => R

Returns the current theme instance.

Options

events

boolean

Enable event emission for registry operations

Default: false

reactive

boolean

Enable reactive behavior for registry operations

Default: false

adapter

ThemeAdapter

The theme adapter to use.

default

ID

The default theme ID to select on initialization.

palette

TokenCollection

A collection of tokens to use for resolving theme colors.

themes

Record<ID, Z>

A record of themes to register.

target

string | HTMLElement

The target element or selector to apply theme classes to.

Properties

collection

ReadonlyMap<ID, Z>

The collection of tickets in the registry

size

number

The number of tickets in the registry

selectedIds

Reactive<Set<ID>>

Set of selected ticket IDs

selectedItems

ComputedRef<Set<E>>

Set of selected ticket instances

selectedValues

ComputedRef<Set<unknown>>

Set of selected ticket values

disabled

MaybeRef<boolean>

Disable state for the entire selection instance

selectedId

ComputedRef<any>

selectedIndex

ComputedRef<number>

selectedItem

ComputedRef<E>

selectedValue

ComputedRef<E["value"]>

colors

ComputedRef<Record<string, Colors>>

A computed reference to the resolved colors of the current theme.

isDark

Readonly<Ref<boolean, boolean>>

A ref indicating whether the current theme is dark.

Methods

clear

() => void

Clear the entire registry

has

(id: ID) => boolean

Check if a ticket exists by ID

keys

() => readonly ID[]

Get all registered IDs

browse

(value: Z["value"]) => ID[] | undefined

Browse for an ID(s) by value

lookup

(index: number) => ID | undefined

lookup a ticket by index number

get

(id: ID) => Z | undefined

Get a ticket by ID

upsert

(id: ID, ticket?: Partial<Z>) => Z

Update or insert a ticket by ID

values

() => readonly Z[]

Get all values of registered tickets

entries

() => readonly [ID, Z][]

Get all entries of registered tickets

unregister

(id: ID) => void

Unregister a ticket by ID

reindex

() => void

Reset the index directory and update all tickets

seek

(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => Z | undefined

Seek for a ticket based on direction and optional predicate

on

<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => void

Listen for registry events

off

<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => void

Stop listening for registry events

emit

<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<Z, K>) => void

Emit an event with data

dispose

() => void

Clears the registry and removes all listeners

offboard

(ids: ID[]) => void

Offboard multiple tickets at once

batch

<R>(fn: () => R) => R

Execute operations in a batch, deferring cache invalidation and event emission until complete

reset

() => void

Clear all selected IDs and reindexes

select

(id: ID) => void

Select a ticket by ID (Toggle ON)

unselect

(id: ID) => void

Unselect a ticket by ID (Toggle OFF)

toggle

(id: ID) => void

Toggles a ticket ON and OFF by ID

selected

(id: ID) => boolean

Check if a ticket is selected by ID

mandate

() => void

Mandates selected ID based on "mandatory" Option

onboard

(registrations: Partial<Z>[]) => E[]

Onboard multiple tickets at once

cycle

(themes?: ID[]) => void

Cycles through the provided themes in order.

register

(registration?: Partial<Z>) => E

Register a theme (accepts input type, returns output type)

Was this page helpful?

© 2016-1970 Vuetify, LLC
Ctrl+/