bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Docs: No info about the collapse plugin supporting checkboxes as toggles

Open carlosmintfan opened this issue 1 year ago • 0 comments

https://getbootstrap.com/docs/5.3/components/collapse/ only tasks about buttons and <a> elements as toggles. However, using checkboxes also works fine, like in the following code provided by ChatGPT. Therefore, it should be pointed out in the docs that you can also use checkboxes as collapse toggles.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
    <title>Checkbox Beispiel</title>
</head>
<body>

<div class="container mt-5">
    <div class="form-check">
        <input class="form-check-input" type="checkbox" id="hideCheckbox" data-bs-toggle="collapse" data-bs-target="#contentToHide" checked>
        <label class="form-check-label" for="hideCheckbox">
            Hide things
        </label>
    </div>

    <div class="collapse mt-3" id="contentToHide">
        <p>Dies ist der Inhalt, der versteckt werden soll.</p>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

</body>
</html>

carlosmintfan avatar Mar 04 '24 20:03 carlosmintfan