#Code

#Import

import { Code } from 'bumbag'

#Usage

Hello world!

#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);
}

#Colors

You can style code with colors from the palette.

Hello world
Hello world
Hello world

#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 "left" | "right" | "center"

alignY "bottom" | "top" | "center"

altitude string

variant string

colorMode string

disabled boolean

overrides

{
  useCSSVariables?: boolean;
  altitudes?: AltitudesThemeConfig;
  borders?: BordersThemeConfig;
  borderRadii?: BorderRadiiThemeConfig;
  ... 94 more ...;
  Template?: TemplateThemeConfig;
}

elementRef ((instance: any) => void) | RefObject<any>

themeKey string

#Theming

Code.styles.base
Hello world
Code.styles.block
Hello world
Copyright © 2020 Jake Moxey