Skip to content

Choices & Tags

SwitchField

SwitchField allows you to add a checkbox type input.

Parameters:

Name Type Description Default
name str

A name.

required
help str | None

A help text. Defaults to None.

None
initial bool | None

An initial value. Defaults to None.

None
label str | None

A label. Defaults to None.

None
validation str | None

A formkit validation in addition to required. Defaults to None.

None
ar.SwitchField("switch")

ChoiceField

ChoiceField allows you to add a select type input.

Parameters:

Name Type Description Default
name str

A name.

required
options list[str]

Options.

required
help str | None

A help text. Defaults to None.

None
initial str | None

An initial value. Defaults to None.

None
label str | None

A label. Defaults to None.

None
required bool | None

Whether it's required or not. Defaults to None.

None
validation str | None

A formkit validation in addition to required. Defaults to None.

None
ar.ChoiceField("choice", ["a", "b"])

MultiChoiceField

MultiChoiceField allows you to have a multiple select type input.

Parameters:

Name Type Description Default
name str

A name.

required
initial list[str]

An initial value.

required
options list[str]

Options.

required
help str | None

A help text. Defaults to None.

None
label str | None

A label. Defaults to None.

None
required bool | None

Whether it's required or not. Defaults to None.

None
validation str | None

A formkit validation in addition to required. Defaults to None.

None
ar.MultiChoiceField("multi-choice", ["a", "b"], ["a", "b", "c"])

TagsField

TagsField allows you to add a multi select type input along with the free form input.

Parameters:

Name Type Description Default
name str

A name.

required
initial list[str]

An initial value.

required
help str | None

A help text. Defaults to None.

None
label str | None

A label. Defaults to None.

None
required bool | None

Whether it's required or not. Defaults to None.

None
validation str | None

A formkit validation in addition to required. Defaults to None.

None
ar.TagsField("tags", ["a", "b"])