Style
/ API Reference / PluginsStyle
/ API Reference / Pluginsdebug
This plugin adds debug styles to elements for simple layout debugging.
It uses styles-debugger under the hood.
The Gist
import { debugPlugin } from '@weser/style'
const plugin = debugPlugin(false, {
debugWith: 'background',
})
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| autoActive | boolean | true | Whether debug styles are active globally |
| config | Config? | {} | Custom styles-debugger configuration |
Config
| Property | Type | Default | Description |
|---|---|---|---|
| debugWith | string | 'outline' | The CSS property to use for debugging ('outline' or 'background') |
Note
When autoActive is disabled, one can opt-in by adding debug: true to a
style object.
Returns
(Plugin) A plugin function that can be passed to the createRenderer function.
Style Type
In order to use this package properly, you need to extend the T_Style type with T_DebugStyle.
import {
createRenderer,
debugPlugin,
type T_Style,
type T_DebugStyle,
} from '@weser/style'
type Style = T_Style & T_DebugStyle
const css = createRenderer<Style>({
plugins: [debugPlugin()],
})
© 2024-present Robin Weser. All Rights Reserved.