gradientFromObject

Commons
stable

Converts a structured IGradient descriptor into a ready-to-use CSS gradient function string (linear-gradient, radial-gradient, or conic-gradient). Intent tokens (e.g. "primary") are resolved to the matching CSS custom property. Pure — no side effects.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

g
requis
IGradient
The gradient descriptor. Supports shorthand { from, to, direction } for two-stop gradients, or { stops } for multi-stop gradients. The type field defaults to "linear".

API

Valeur de retour

La valeur retournée par cet util.

A CSS gradient function string ready to use as background-image or background value.

Usage

Exemples

Extraits de code prêts à coller.

Intent shorthand and multi-stop

typescript