django-crispy-forms / crispy-bootstrap5

Bootstrap5 template pack for django-crispy-forms
MIT License
451 stars 72 forks source link

Tab and TabHolder ignore css_class attribute #178

Closed philgyford closed 1 month ago

philgyford commented 3 months ago

The tab.html template does not use the css_class attribute if supplied to Tab() or TabHolder()

kosdmit commented 2 months ago

This issue seems very similar to issue #168. I've sent PR #180 for close that issue, and if it get positive review i can close this too.

kosdmit commented 1 month ago

Hi, @smithdc1, actually this issue is not fixed yet.

As you can see, this layout:

test_form.helper.layout = Layout(
  TabHolder(
      Tab(
          "one",
          "first_name",
          css_id="custom-name",
          css_class="first-tab-class active",
      ),
      css_class="test tab-holder-class"
  )
)

renders TabHolder without css class test tab-holder-class:

<form method="post">
  <ul class="nav nav-tabs">
    <li class="nav-item"><a class="nav-link active" href="#custom-name" data-bs-toggle="tab">One</a></li>
  </ul>
  <div class="tab-content card-body">
    <div id="custom-name" class="tab-pane first-tab-class active">
      <div id="div_id_first_name" class="mb-3">
        <label for="id_first_name" class="form-label requiredField">
          first name<span class="asteriskField">*</span>
        </label>
        <input type="text" name="first_name" maxlength="5" class="textinput textInput inputtext form-control" required id="id_first_name">
      </div>
    </div>

  </div>
</form>
kosdmit commented 1 month ago

This Issue can be closed ✔