Skip to main content

Other fields

Select a color

New in v14.0.0

The ColorField enables a user to select a color from a color palette.

import viktor as vkt


class Parametrization(vkt.Parametrization):
color = vkt.ColorField('Pick a color')

The value is returned in the params as a Color object.

Select a date

The DateField enables a user to select a date on a calendar.

import viktor as vkt


class Parametrization(vkt.Parametrization):
date = vkt.DateField('Pick a date')

The value is returned in the params as a datetime.date object.

Toggle button

The BooleanField acts as a toggle button which can be either True or False:

import viktor as vkt


class Parametrization(vkt.Parametrization):
is_true = vkt.BooleanField('False / True')

Generic JSON data

The purpose of the HiddenField is to store JSON-type data in the params, without showing this information to the user in the editor. For example, when doing upload file processing.

import viktor as vkt


class Parametrization(vkt.Parametrization):
json_data = vkt.HiddenField('This is not visible')
caution

Use the HiddenField with moderation. Prefer to store specific type of data on its corresponding field (e.g. number on a NumberField), if necessary with visible=False to hide if from the user. Also, prevent storing very large amounts of data if not necessary, as this might make your application slow and unstable!

Manual line break

For more information on how to add a manual line break to the parametrization, see LineBreak. There is no value associated with a LineBreak within the params.