Tabs

class crispy_forms_gds.layout.Tabs(*fields, **kwargs)

A layout object for displaying a set of tabs.

Tabs contains a list of TabPanels which in turn contains the list of fields and other layout objects which make up the content of each tab.

Examples:

Tabs(
    TabPane('tab_name_1', 'form_field_1', 'form_field_2'),
    TabPane('tab_name_2', 'form_field_3')
)
Parameters
  • css_id (str, optional) – an unique identifier for the parent <div>.

  • css_class (str, optional) – the names of one or more CSS classes that will be added to the parent <div>. The basic Design System CSS classes will be added automatically. This parameter is for any extra styling you want to apply.

  • template (str, optional) – the path to a template that overrides the one provided by the template pack.

  • *fields – a list of TabPanel objects that make up the set of tabs.

  • **kwargs – any additional attributes you want to add to the parent <div>.

TabPanel

class crispy_forms_gds.layout.TabPanel(name, *fields, **kwargs)

A layout object that displays the contents of each pane in a set of tabs.

Examples:

TabPanel('tab_name', 'form_field_1', 'form_field_2', 'form_field_3')
Parameters
  • name (str) – the title of the panel.

  • css_id (str, optional) – an unique identifier for the parent <div>. If you don’t set this then the slugified title is used for the id attribute. You must set this if you have more than one set of tabs on a page with the same set of titles.

  • css_class (str, optional) – the names of one or more CSS classes that will be added to the parent <div>. The basic Design System CSS classes will be added automatically. This parameter is for any extra styling you want to apply.

  • template (str, optional) – the path to a template that overrides the one provided by the template pack.

  • *fields – a list of layout objects that make up the contents of the panel.

  • **kwargs – any additional attributes you want to add to the <div> element used for create the tab panel.