Code#
Import#
import { Code } from 'bumbag'
Usage#
Hello world!Editable example
Code blocks#
A code block can be rendered by setting the isBlock prop. This will wrap the code in a <pre>.
function log(message) {
console.log(message);
}Editable example
Colors#
You can style code with colors from the palette.
Hello worldHello worldHello worldEditable example
Code Props#
isBlock boolean
Indicates if the code should be placed in a block.
palette
"default"
| "primary"
| "secondary"
| "success"
| "danger"
| "warning"
| (string & {})Color of the code (inline) block.
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Theming#
Code.styles.baseHello worldCode.styles.blockHello world
On this page
