API and Development
toDataColor and the DataColor type from @prepared911/ui/data-color. There is no React component: the entry point brands strings at the data boundary.
| Name | Type | Default | Description |
|---|---|---|---|
value | string | required | Raw color from third-party data. Trimmed for validation; returned unchanged when valid. |
returns | DataColor | undefined | — | Branded color, or undefined when validation fails. |
string. Do not cast arbitrary strings; use toDataColor. Components re-validate at paint time.
No dedicated stories ship on this entry point; see Shape and Swatch for painted examples.
DataColor extends string, so plain string props do not block it at compile time. Enforcement targets where paint is allowed:
DataColor on color-semantic props (Box background, Text foreground, Icon foreground): packages/ui/src/components/data-color/scope.type-test.tsShape, Swatch, vector-paint, and the model may reference DataColor for paint: packages/ui/tests/data-color-scope.test.tsdesign-system/to-data-color-call (warn): calls to toDataColor from any @prepared911/ui entry point and as DataColor casts, in apps, remotes and packages