Canvacord

Builder

Create a new builder.

new Builder(width, height)
ParameterTypeDescriptionOptional
width

the width of this builder.

height

the height of this builder.

Properties

components

The components of this builder.

graphemeProvider

The grapheme provider of this builder.

height

the height of this builder.

Type:number

options

The options manager of this builder.

tw

The tailwind subset to apply to this builder.

Type:string

width

the width of this builder.

Type:number

style

Get the style of this builder.

Type:CSSProperties

Methods

addComponent(component);

Add component to this builder.

ParameterTypeDescriptionOptional
component
T|Array<T>

the component to add.

Returns:Builder<T>

adjustCanvas();

Adjust the canvas size.

Returns:Builder<T>

bootstrap(data);

Bootstrap this builder with data.

ParameterTypeOptional
data
T
Returns:void

build(options);

Convert this builder into an image.

ParameterTypeDescriptionOptional
options

the build options.

the image buffer or svg string.

render();

Render this builder.

Returns:Promise<ReactNode>

setGraphemeProvider(provider);

Set grapheme image provider for this builder.

ParameterTypeOptional
provider
Returns:Builder<T>

setStyle(newStyle);

Set the style of this builder.

ParameterTypeDescriptionOptional
newStyle
CSSProperties

the new style.

Returns:Builder<T>

static from(template);

Create a builder from builder template.

ParameterTypeOptional
template
Returns:Builder<Record<string|unknown>>