diff --git a/docs/components/checkbox.njk b/docs/components/checkbox.njk
index 2ca4d51..8240972 100644
--- a/docs/components/checkbox.njk
+++ b/docs/components/checkbox.njk
@@ -28,10 +28,13 @@ toc:
Usage
- Simply add the input class to your <input type="radio"> elements or have a parent with the form class (read more about form). You can also set the aria-invalid attribute to true to make the input invalid.
+ Add the input class to your <input type="radio"> elements or have a parent with the form class (read more about form). You can also set the aria-invalid attribute to true to make the input invalid.
-{{ code_block(code) }}
+
diff --git a/docs/components/combobox.njk b/docs/components/combobox.njk
index 5d942e5..c2cb280 100644
--- a/docs/components/combobox.njk
+++ b/docs/components/combobox.njk
@@ -6,15 +6,15 @@ toc:
- label: Usage
id: usage
children:
- - label: Default
- id: usage-default
- label: Jinja or Nunjucks
id: usage-jinja
- label: Examples
id: examples
children:
- - label: With groups
- id: example-with-groups
+ - label: Scrollable
+ id: example-scrollable
+ - label: Top side
+ id: example-top
---
{% from "macros/code_preview.njk" import code_preview %}
@@ -27,6 +27,7 @@ toc:
trigger_attrs={"class": "w-[200px]"},
listbox_attrs={"data-empty": "No framework found."},
is_combobox=true,
+ search_placeholder="Search framework...",
register_on=["alpine:init", "htmx:afterSwap"]
) %}
{% for framework in options_frameworks %}
@@ -37,26 +38,45 @@ toc:
-
-
- The Combobox component uses the same Alpine.js code as the Select component, and almost identical markup, the only difference being the search box.
+ Combobox uses the same Alpine.js code and markup as the Select component, the only difference being the search box at the top of the listbox.
+ You can set up a few additional options on the <div data-popover> element:
+
+ data-side can be set to top, bottom, left, or right to change the side of the popover.
+ data-align can be set to start, center, or end to change the alignment of the popover.
+ data-empty to set up the message when the search is empty.
+
-{{ code_block(code | prettyHtml) }}
+
HTML
+
+
+ {% set code_html %}
+ {% call select(
+ trigger_attrs={"class": "w-[200px]"},
+ listbox_attrs={"data-empty": "No framework found."},
+ is_combobox=true,
+ search_placeholder="Search framework...",
+ register_on=["alpine:init", "htmx:afterSwap"]
+ ) %}
+ {% for framework in options_frameworks %}
+ {{ framework }}
+ {% endfor %}
+ {% endcall %}{% endset %}
+ {{ code_block(code_html | prettyHtml) }}
+
+
+
Javascript (Alpine.js)
+
+
+ {% set code_script %}{% include "components/select-script.njk" %}{% endset %}
+ {{ code_block(code_script | prettyHtml) }}
+
- If you use Jinja (or Nunjucks), you can use the select() macro directly, making sure to set is_combobox to True (or true for Nunjucks).
-
+ If you use Jinja (or Nunjucks), you can use the select() macro directly, making sure to set is_combobox to True (or true for Nunjucks). Read more about using Basecoat with Jinja and Nunjucks.
{% set raw_code %}{% raw %}{% call select(
@@ -73,7 +93,7 @@ toc:
-
+
{% set options_timezones = [
{
@@ -116,6 +136,7 @@ toc:
content_attrs={"class": "w-72"},
listbox_attrs={"data-empty": "No timezone found."},
is_combobox=true,
+ search_placeholder="Search timezone...",
register_on=["alpine:init", "htmx:afterSwap"]
) %}