Skip to main content

Manual line break

A LineBreak can be used to force input fields to be placed on the next 'line' to obtain a cleaner looking parametrization within an editor.

import viktor as vkt


class Parametrization(vkt.Parametrization):
n1 = vkt.NumberField('N1')
n2 = vkt.NumberField('N2')
lb = vkt.LineBreak() # split the fields in 2 pairs
n3 = vkt.NumberField('N3')
n4 = vkt.NumberField('N4')

Hide a line break​

New in v14.37.0

A LineBreak can be hidden with the visible argument, in the same way as hiding a field. This keeps the editor free of empty space when the fields around the line break are hidden too.

import viktor as vkt


class Parametrization(vkt.Parametrization):
show_advanced = vkt.BooleanField('Show advanced settings')
n1 = vkt.NumberField('N1', visible=vkt.Lookup('show_advanced'))
lb = vkt.LineBreak(visible=vkt.Lookup('show_advanced'))
n2 = vkt.NumberField('N2', visible=vkt.Lookup('show_advanced'))