# Buttons

References

  - Foundation 6 Button;

  - Foundation 6 Button Group;

class crispy_forms_foundation.layout.buttons.ButtonHolder(*fields, css_id=None, css_class=None, template=None)

  Bases: `ButtonHolder`

  It wraps fields in an element `<div class="button-holder">`.

  This is where you should put Layout objects that render to form buttons like Submit. It should only hold `HTML` and `BaseInput` inherited objects.

  Example:

      ButtonHolder(
          HTML(<span style="display: hidden;">Information Saved</span>),
          Submit('Save', 'Save')
      )

class crispy_forms_foundation.layout.buttons.ButtonHolderCallout(field, *args, **kwargs)

  Bases: `ButtonHolder`

  Act like `ButtonHolder` but add a `callout` class name on the main `div`.

class crispy_forms_foundation.layout.buttons.ButtonGroup(*fields, **kwargs)

  Bases: `LayoutObject`

  It wraps fields in an element `<div class="button-group">`.

  This is where you should put Layout objects that render to form buttons like Submit. It should only hold HTML and BaseInput inherited objects.

  Example:

      ButtonGroup(
          Submit('Save', 'Save'),
          Button('Cancel', 'Cancel'),
      )

class crispy_forms_foundation.layout.buttons.Button(name, value, *, css_id=None, css_class=None, template=None, **kwargs)

  Bases: `InputButton`

  This is the old Button object that inherit from `InputButton` for backward compatibility.

  If you want to stand for an input button, you are invited to use `InputButton` instead to avoid problem when `ButtonElement` will become the new `Button` object.

class crispy_forms_foundation.layout.buttons.Submit(name, value, *, css_id=None, css_class=None, template=None, **kwargs)

  Bases: `InputSubmit`

  This is the old Button object that inherit from `InputSubmit` for backward compatibility.

  If you want to stand for an input button, you are invited to use `InputSubmit` instead to avoid problem when `ButtonSubmit` will become the new `Submit` object.

class crispy_forms_foundation.layout.buttons.Reset(name, value, *, css_id=None, css_class=None, template=None, **kwargs)

  Bases: `InputReset`

  This is the old Button object that inherit from `InputReset` for backward compatibility.

  If you want to stand for an input button, you are invited to use `InputReset` instead to avoid problem when `ButtonReset` will become the new `Reset` object.

class crispy_forms_foundation.layout.buttons.InputButton(name, value, *, css_id=None, css_class=None, template=None, **kwargs)

  Bases: `BaseInput`

  Used to create a Submit input descriptor for the {% crispy %} template tag:

      button = InputButton('Button 1', 'Press Me!')

  Note

  The first argument is also slugified and turned into the id for the button.

class crispy_forms_foundation.layout.buttons.InputSubmit(name, value, *, css_id=None, css_class=None, template=None, **kwargs)

  Bases: `BaseInput`

  Used to create a Submit button descriptor for the {% crispy %} template tag:

      submit = Submit('Search the Site', 'search this site')

class crispy_forms_foundation.layout.buttons.InputReset(name, value, *, css_id=None, css_class=None, template=None, **kwargs)

  Bases: `BaseInput`

  Used to create a Reset button input descriptor for the `{% crispy %}` template tag:

      reset = Reset('Reset This Form', 'Revert Me!')

class crispy_forms_foundation.layout.buttons.ButtonElement(field, *args, **kwargs)

  Bases: `BaseInput`

  Contrary to `Button`, ButtonElement purpose use a `<button>` element to create a clickable form button and accept an argument to add free content inside element.

  Advantage of `<button>` is to accept almost any HTML content inside element.

      button = ButtonElement('name', 'value',
                             content="<span>Press Me!</span>")

  Note

  - First argument is for `name` attribute and also turned into the id for the button;

  - Second argument is for `value` attribute and also for element content if not given;

  - Third argument is an optional named argument `content`, if given it will be appended inside element instead of `value`. Content string is marked as safe so you can put anything you want;

  render(form, context, template_pack=<SimpleLazyObject: <function get_template_pack>>)

    Renders an <input /> if container is used as a Layout object. Input button value can be a variable in context.

class crispy_forms_foundation.layout.buttons.ButtonSubmit(field, *args, **kwargs)

  Bases: `ButtonElement`

  Create a submit button following the `ButtonElement` behaviors:

      button = ButtonSubmit('search', 'go-search',
                            content="<span>Search this site!</span>")

class crispy_forms_foundation.layout.buttons.ButtonReset(field, *args, **kwargs)

  Bases: `ButtonElement`

  Create a reset button following the `ButtonElement` behaviors:

      button = ButtonReset('reset', 'revert'
                           content="<span>Revert Me!</span>")