{# LIBRARIES #}
{{ attach_library('ui_patterns/libraries.bs_forms') }}
{{ attach_library('ui_patterns/form-form.form_lib') }}

{# VARIABLES #}
{% set attributes = attributes|default(create_attribute()) %}
{% set classes = [
  title_display == 'after' ? 'option',
  title_display == 'invisible' ? 'visually-hidden',
  required ? 'js-form-required',
  required ? 'form-required',
] %}
{%- if title is not empty or required -%}
  <label {{ attributes.addClass(classes) }}>
    {{ title|raw }}
    {%- if required -%}
      {# Deprecating in favor of CSS for JS.
      <span class="reqd">*</span>
      <span class="sr-only">Required form item</span>
      #}
    {%- endif -%}
  </label>
{%- endif -%}
