Skip to Content
Hookboard
Components

Input components

Every input component a card can use, with its properties and an example.

Each component is an object with a type and the properties listed for it. Text and number properties may also hold a {{ }} template or a { "$bind": "…" } object; see Data, state and bindings. Every component also accepts the common properties.

button

Runs an action when pressed.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
labeltextyesButton text.
variant"primary" "secondary" "outline" "ghost" "danger""secondary"Visual weight.
size"sm" "md" "lg""md"Size.
iconicon nameIcon before the label.
fullbooleanStretch to the full width.
disabledWhenexpressionExpression; the button is disabled while it is true.
onPressaction or list of actionsWhat happens when pressed.
{
  "type": "button",
  "label": "Press me",
  "onPress": {
    "type": "toast",
    "message": "Pressed"
  }
}

input

A single-line text field.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
labeltextLabel above the field.
placeholdertextHint shown when empty.
kind"text" "number" "email" "url" "password" "date" "time""text"What is being typed.
onSubmitaction or list of actionsRuns when Enter is pressed.
{
  "type": "input",
  "bind": "state.text",
  "label": "Label",
  "placeholder": "Type here"
}

textarea

A multi-line text field.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
labeltextLabel above the field.
placeholdertextHint shown when empty.
rowsnumber3Visible lines.
{
  "type": "textarea",
  "bind": "state.note",
  "label": "Note"
}

select

Pick one from a dropdown.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
labeltextLabel above the field.
placeholdertextHint shown when empty.
optionslist of objectsyesThe choices offered.
options[].labeltextyesText shown.
options[].valuetextyesValue stored.
onChangeaction or list of actionsRuns after the choice changes.
{
  "type": "select",
  "bind": "state.choice",
  "label": "Choose",
  "options": [
    {
      "label": "One",
      "value": "one"
    },
    {
      "label": "Two",
      "value": "two"
    }
  ]
}

radio

Pick one from a visible list.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
labeltextLabel above the group.
optionslist of objectsyesThe choices offered.
options[].labeltextyesText shown.
options[].valuetextyesValue stored.
onChangeaction or list of actionsRuns after the choice changes.
{
  "type": "radio",
  "bind": "state.choice",
  "options": [
    {
      "label": "One",
      "value": "one"
    },
    {
      "label": "Two",
      "value": "two"
    }
  ]
}

segmented

Pick one from a compact row of buttons.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
optionslist of objectsyesThe choices offered.
options[].labeltextyesText shown.
options[].valuetextyesValue stored.
onChangeaction or list of actionsRuns after the choice changes.
{
  "type": "segmented",
  "bind": "state.range",
  "options": [
    {
      "label": "Day",
      "value": "day"
    },
    {
      "label": "Week",
      "value": "week"
    }
  ]
}

checkbox

A checkbox with a label.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
labeltextyesText beside the box.
onChangeaction or list of actionsRuns after it is toggled.
{
  "type": "checkbox",
  "bind": "state.agree",
  "label": "I agree"
}

switch

An on/off switch with a label.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
labeltextyesText beside the switch.
descriptiontextSecond line under the label.
onChangeaction or list of actionsRuns after it is toggled.
{
  "type": "switch",
  "bind": "state.enabled",
  "label": "Enabled"
}

slider

Pick a number by dragging.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
bindstate pathyesState path this input reads and writes, e.g. state.name.
labeltextLabel above the slider.
minnumber0Lowest value.
maxnumber100Highest value.
stepnumber1Increment.
showValuebooleanShow the current value.
onCommitaction or list of actionsRuns when dragging ends.
{
  "type": "slider",
  "bind": "state.level",
  "label": "Level",
  "showValue": true
}

On this page