Knobs

Knobs can be used to dynamically change the parameters passed to a usecase.

Knobs

Usage

Use context.knobs to access the knobs builder and add knobs to your Widget:

WidgetbookUseCase(
  name: 'elevated',
  builder: (context) => MyHomePage(
    title: context.knobs.text(
      label: 'Title Label',
      initialValue: 'HomePage',
    ),
  )
)

Properties

All Knobs have the following inherited properties to customize how the knobs are displayed in the UI of Widgetbook:

PropertyTypeDescription
labelStringLabels the knob by giving it a title. The label must be unique for the WidgetbookUseCase.
descriptionString?A text which describes what the knob does. This can be used as a documentation within Widgetbook and helps your team member understand how to operate the knob.

Available Knobs

NameType
booleanbool
nullableBooleanbool?
textString
nullableTextString?
sliderdouble
nullableSliderdouble?
numbernum
nullableNumbernum?
optionsT

You can see an example of this and different knobs available here.