useBackgroundColor

Commons
stable

Surface-only color helper. Resolves the `bgColor` prop (or a reactive ref) to a utility class (`origam--bg-*`) when the value is a tokenised intent, or to an inline background-color declaration for raw CSS values.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

Interfaces consommées

IBgColorProps

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

props
requis
T | Ref<TColor>
Either the component props object (paired with `name`) or a plain Ref<TColor>.
name
K
The key to read from the props object. Typically "bgColor". Omit when passing a plain Ref.

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

backgroundColorClasses
Utility class names (e.g. ["origam--bg-primary"]) to bind via :class. Empty when value is gradient or raw hex.
backgroundColorStyles
Inline CSS declarations (e.g. ["background-color: #ff0080"]) to bind via :style. Empty when a utility class applies.

Usage

Exemples

Extraits de code prêts à coller.

Usage with props object

vue

Usage with a plain Ref

vue