You are here

uikit-alert.html.twig in UIkit Components 8.3

Default theme implementation for a UIkit Alert.

Available variables:

  • message: The message to display in the alert.
  • style: The style of the alert. Possible values:
    • primary: Give the message a prominent styling.
    • success: Indicates success or a positive message.
    • warning: Indicates a message containing a warning.
    • danger: Indicates an important or error message.

    Defaults to "primary".

  • close_button: Boolean indicating whether to include a close button in the alert. Defaults to FALSE.

File

templates/components/uikit-alert.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a UIkit Alert.
  5. *
  6. * Available variables:
  7. * - message: The message to display in the alert.
  8. * - style: The style of the alert. Possible values:
  9. * - primary: Give the message a prominent styling.
  10. * - success: Indicates success or a positive message.
  11. * - warning: Indicates a message containing a warning.
  12. * - danger: Indicates an important or error message.
  13. * Defaults to "primary".
  14. * - close_button: Boolean indicating whether to include a close button in the
  15. * alert. Defaults to FALSE.
  16. *
  17. * @see \Drupal\uikit_components\Element\UIkitAlert
  18. * @see template_preprocess_uikit_alert()
  19. * @see https://getuikit.com/docs/alert
  20. *
  21. * @ingroup uikit_components_theme_render
  22. */
  23. #}
  24. {% if message %}
  25. <div{{ attributes.addClass('uk-alert-' ~ style|clean_class) }}>
  26. {% if close_button %}
  27. <a class="uk-alert-close" data-uk-close></a>
  28. {% endif %}
  29. <p>{{ message }}</p>
  30. </div>
  31. {% endif %}

Related topics