Usage
The Theme component allows you to override default slot classes and props of all child components without modifying each one individually. It uses Vue's provide / inject mechanism under the hood, so the overrides apply at any depth.
Slot classes
Use the b24ui prop to override slot classes of descendant components. Keys are component names (camelCase) and values are their slot class overrides.
Prop defaults Soon
Use the props prop to override the default value of any prop on descendant components. Each key maps to a partial of that component's props.
<B24Button color="air-primary" />) always win over <B24Theme :props>. Theme defaults only apply when the prop wasn't passed explicitly.Examples
Multiple components
Use different keys in b24ui or props to theme multiple component types at once.
Nested themes
Nest multiple Theme components to compose overrides. The innermost Theme takes precedence, while unoverridden keys are inherited from the outer Theme.
Explicit priority
Explicitly setting any prop (including b24ui) on an individual component always takes priority over the Theme component.
Deep propagation
The overrides are available to all descendant components regardless of how deeply nested they are.
MyButton is a custom component that renders a B24Button internally. The theme overrides still apply because they propagate through the entire component tree.Form components
Use the Theme component to apply consistent styling across a group of form components.
<B24FormField>, <B24FieldGroup> and <B24AvatarGroup> keep precedence over <B24Theme :props> for size, color and highlight. Validation errors also force the error color over any theme value.Prose components
Use the prose namespace to theme typography components. Keys are nested under prose (e.g. prose.p, prose.code).
Getting started
This is a paragraph with a tighter typographic scale applied through the Theme component.
- First item
- Second item
- Third item
The spacing and font sizes are smaller than the defaults, making it ideal for compact content areas.