Skip to content

pencil.js / button / ButtonOptions

Interface: ButtonOptions ​

Defined in: button.ts:11

Button options

Extends ​

  • InputOptions
  • Pick<TextOptions, | "font" | "fontSize" | "align" | "bold" | "italic" | "underscore" | "lineHeight" | "rounded">

Properties ​

PropertyTypeDescriptionOverridesInherited fromDefined in
activeStyleColor of the background when pressed--button.ts:15
alignCanvasTextAlignText horizontal alignment-TextOptions.aligntext.ts:18
boldbooleanUse bold font-weight-TextOptions.boldtext.ts:20
cap?CanvasLineCapHow lines end-InputOptions.capcomponent.ts:85
clip| Component<ComponentOptions> | nullOther component used to clip the rendering-InputOptions.clipcontainer.ts:26
cursorstring | nullCursor to use when hover-InputOptions.cursorcomponent.ts:81
dashedboolean | number[]Should the line be dashed, you can also specify the dash pattern (ex: [4, 4] or Component.dashes.dots)-InputOptions.dashedcomponent.ts:79
fillStyleColor used to fill, set to null for transparent-InputOptions.fillcomponent.ts:73
fontstringFont to use (can be a URL)-TextOptions.fonttext.ts:14
fontSizenumberSize of the text in pixels-TextOptions.fontSizetext.ts:16
foregroundStyleColor of the foreground elements-InputOptions.foregroundwidget.ts:13
hoverStyleColor of the background when hovered-InputOptions.hoverinput.ts:13
italicbooleanUse italic font-style-TextOptions.italictext.ts:22
joinCanvasLineJoinHow lines join between them-InputOptions.joincomponent.ts:83
lineHeightnumberRatio of line height (1 is normal, 2 is twice the space)-TextOptions.lineHeighttext.ts:26
opacitynumber | nullOpacity level from 0 to 1 (multiplied with its parents opacity, null means 1)-InputOptions.opacitycontainer.ts:16
origin| string | PositionDefinitionRelative offset (Rectangle based shapes also accept named origins like "center")-InputOptions.origincomponent.ts:87
rotationnumberRotation ratio from 0 to 1 (clockwise)-InputOptions.rotationcontainer.ts:18
rotationCenterPositionDefinitionCenter of rotation relative to this position-InputOptions.rotationCentercontainer.ts:20
roundednumber | DOMPointInit | (number | DOMPointInit)[]Radius of the corners (or a list of radii, see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect)-RectangleOptions.roundedrectangle.ts:10
scale| number | PositionDefinitionScaling ratio or a pair of value for horizontal and vertical scaling-InputOptions.scalecontainer.ts:22
shadowPartial<ShadowOptions>Set of options to set a shadow-InputOptions.shadowcomponent.ts:89
shownbooleanIs shown-InputOptions.showncontainer.ts:14
strokeStyleColor used to stroke, set to null for transparent-InputOptions.strokecomponent.ts:75
strokeWidthnumberStroke line thickness in pixels-InputOptions.strokeWidthcomponent.ts:77
underscorebooleanDraw a line under the text-TextOptions.underscoretext.ts:24
valuestring | string[]Text of the buttonInputOptions.value-button.ts:13
zIndexnumberDepth ordering-InputOptions.zIndexcontainer.ts:24

Released under the MIT License.