useTheme API
API reference for the useTheme composable.
(_options?: ThemeOptions<ThemeRecord>) => RCreates a new theme instance.
(_options?: ThemeContextOptions) => ContextTrinity<R>Creates a new theme context trinity.
(_options?: ThemePluginOptions) => anyCreates a new theme plugin.
(namespace?: string) => RReturns the current theme instance.
booleanEnable event emission for registry operations
Default: false
booleanEnable reactive behavior for registry operations
Default: false
ThemeAdapterThe theme adapter to use.
IDThe default theme ID to select on initialization.
TokenCollectionA collection of tokens to use for resolving theme colors.
Record<ID, Z>A record of themes to register.
string | HTMLElementThe target element or selector to apply theme classes to.
ReadonlyMap<ID, Z>The collection of tickets in the registry
numberThe number of tickets in the registry
Reactive<Set<ID>>Set of selected ticket IDs
ComputedRef<Set<E>>Set of selected ticket instances
ComputedRef<Set<unknown>>Set of selected ticket values
MaybeRef<boolean>Disable state for the entire selection instance
ComputedRef<Record<string, Colors>>A computed reference to the resolved colors of the current theme.
Readonly<Ref<boolean, boolean>>A ref indicating whether the current theme is dark.
() => voidClear the entire registry
(id: ID) => booleanCheck if a ticket exists by ID
() => readonly ID[]Get all registered IDs
(value: Z["value"]) => ID[] | undefinedBrowse for an ID(s) by value
(index: number) => ID | undefinedlookup a ticket by index number
(id: ID) => Z | undefinedGet a ticket by ID
(id: ID, ticket?: Partial<Z>) => ZUpdate or insert a ticket by ID
() => readonly Z[]Get all values of registered tickets
() => readonly [ID, Z][]Get all entries of registered tickets
(id: ID) => voidUnregister a ticket by ID
() => voidReset the index directory and update all tickets
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => Z | undefinedSeek for a ticket based on direction and optional predicate
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => voidListen for registry events
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => voidStop listening for registry events
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<Z, K>) => voidEmit an event with data
() => voidClears the registry and removes all listeners
(ids: ID[]) => voidOffboard multiple tickets at once
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
() => voidClear all selected IDs and reindexes
(id: ID) => voidSelect a ticket by ID (Toggle ON)
(id: ID) => voidUnselect a ticket by ID (Toggle OFF)
(id: ID) => voidToggles a ticket ON and OFF by ID
(id: ID) => booleanCheck if a ticket is selected by ID
() => voidMandates selected ID based on "mandatory" Option
(registrations: Partial<Z>[]) => E[]Onboard multiple tickets at once
(themes?: ID[]) => voidCycles through the provided themes in order.
(registration?: Partial<Z>) => ERegister a theme (accepts input type, returns output type)