customization
deprecations
Deprecations
Deprecating tokens, utilities, patterns and config recipes.
Deprecations are mostly relevant for large teams that want to deprecate certain utilities, patterns, recipes, or tokens before removing them from the codebase.
Marking something deprecated
Set the deprecated property to true on the definition itself:
bamboo.config.ts
import { defineConfig } from '@bamboocss/dev'
export default defineConfig({
utilities: {
ta: {
deprecated: true,
transform(value) {
return { textAlign: value }
},
},
},
})The property goes in the same place for each kind of definition:
| Kind | Where it goes |
|---|---|
| Utility | utilities.<name>.deprecated |
| Token | theme.tokens.<category>.<name>.deprecated (alongside value) |
| Pattern | patterns.<name>.deprecated |
| Recipe | theme.recipes.<name>.deprecated |
Custom Deprecation Messages
Tokens, patterns and recipes also accept a string instead of true — the migration message to report in place of the
default one. Utilities do not: deprecated is a boolean there.
bamboo.config.ts
import { defineConfig } from '@bamboocss/dev'
export default defineConfig({
theme: {
tokens: {
colors: {
primary: { value: 'blue.500', deprecated: 'use `blue.600` instead' },
},
},
recipes: {
btn: {
deprecated: 'will be removed in v2.0',
},
},
},
})