Working on CLI

This commit is contained in:
Ronan Berder
2025-05-01 20:53:03 +08:00
parent 930e0ee6f1
commit 0c4a14816e
73 changed files with 1961 additions and 706 deletions
+13 -9
View File
@@ -14,7 +14,7 @@ toc:
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
{% from "components/dialog.njk" import dialog %}
{% from "dialog.njk" import dialog %}
{% set code_html %}
{% set footer %}
@@ -34,9 +34,13 @@ toc:
) }}
{% endset %}
{% set code_script %}
{% include "components/dialog-script.njk" %}
{% endset %}
{% set code_script %}<script>
{% fetchCode "src/js/dialog.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerDialog(Alpine);
});
</script>{% endset %}
{{ code_preview("alert-dialog", code_script | prettyHtml ~ code_html | prettyHtml) }}
@@ -52,18 +56,18 @@ toc:
</section>
</div>
<p class="prose my-6">The Alert Dialog component uses the same Alpine.js code as the <a href="/components/dialog" class="font-medium underline underline-offset-4">Dialog</a> component with one small difference: we set <code>initialCloseOnOverlayClick</code> to <code>false</code> to prevent the dialog from closing when the overlay is clicked.</p>
<p class="prose">The Alert Dialog component uses the same Alpine.js code as the <a href="/components/dialog" class="font-medium underline underline-offset-4">Dialog</a> component with one small difference: we set <code>initialCloseOnOverlayClick</code> to <code>false</code> to prevent the dialog from closing when the overlay is clicked.</p>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="alert-dialog", tabsets=tabsets) }}
<h3 id="usage-jinja"><a href="#usage-jinja">Jinja or Nunjucks</a></h3>
<p class="my-6 prose">If you use Jinja (or Nunjucks), you can use the <code>dialog()</code> macro directly, making sure to set <code>close_on_overlay_click</code> and <code>close_button</code> to <code>False</code> (or <code>false</code> for Nunjucks). <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
<p class="prose">If you use Jinja (or Nunjucks), you can use the <code>dialog()</code> macro directly, making sure to set <code>close_on_overlay_click</code> and <code>close_button</code> to <code>False</code> (or <code>false</code> for Nunjucks). <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
{% set raw_code %}{% raw %}{% set footer %}
<button class="btn-outline" @click="open = false">Cancel</button>
+1 -1
View File
@@ -28,7 +28,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>You can use one of the two classes: <code>alert</code> or <code>alert-dialog</code> with any of the following children:</p>
<ul>
<li>A svg icon,</li>
+1 -1
View File
@@ -20,4 +20,4 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<p class="my-6 prose">Avatars are fairly simple to implement with Tailwind. The example above shows how to implement one with Tailwind and an <code>&lt;img&gt;</code> element. More examples can be found in the <a href="/kitchen-sink#avatar">kitchen sink</a>.</p>
<p class="prose">Avatars are fairly simple to implement with Tailwind. The example above shows how to implement one with Tailwind and an <code>&lt;img&gt;</code> element. More examples can be found in the <a href="/kitchen-sink#avatar">kitchen sink</a>.</p>
+1 -1
View File
@@ -30,7 +30,7 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<section class="prose my-6">
<section class="prose">
<p>Use one of the badge classes: <code>badge</code>, <code>badge-primary</code>, <code>badge-secondary</code>, <code>badge-destructive</code> or <code>badge-outline</code>.
</section>
+12 -6
View File
@@ -9,7 +9,7 @@ toc:
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
{% from "components/dropdown-menu.njk" import dropdown_menu %}
{% from "dropdown-menu.njk" import dropdown_menu %}
<div class="alert mb-6">
{% lucide "circle-alert" %}
@@ -17,7 +17,13 @@ toc:
</div>
{% set code_script %}
{% include "components/dropdown-menu-script.njk" %}
<script>
{% fetchCode "src/js/dropdown-menu.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerDropdownMenu(Alpine);
});
</script>
{% endset %}
{% set code_html %}
@@ -58,13 +64,13 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<section class="prose my-6">
<section class="prose">
<p>The example above uses some simple Tailwind CSS along with the <a href="/components/dropdown-menu">Dropdown Menu</a>.</p>
</section>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="alert-dialog", tabsets=tabsets) }}
+2 -4
View File
@@ -40,7 +40,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>You can use one of the <code>btn</code> classes to style any element as a button:</p>
<ul>
@@ -68,9 +68,7 @@ toc:
</ul>
</section>
<section class="my-6">
{{ code_block(code) }}
</section>
{{ code_block(code) }}
<h2 id="examples"><a href="#examples">Examples</a></h2>
+1 -1
View File
@@ -47,7 +47,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>Add the <code>card</code> class to any element and then define any of the children elements:</p>
<ul>
<li>A <code>&lt;header&gt;</code> for the card header, which can contain a <code>&lt;h2&gt;</code> for the title and a <code>&lt;p&gt;</code> for the description.</li>
+3 -5
View File
@@ -27,14 +27,12 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>Add the <code>input</code> class to your <code>&lt;input type="radio"&gt;</code> elements or have a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>). You can also set the <code>aria-invalid</code> attribute to <code>true</code> to make the input invalid.</p>
</section>
<section class="my-6">
{% set code %}<input type="checkbox" class="input">{% endset %}
{{ code_block(code) }}
</section>
{% set code %}<input type="checkbox" class="input">{% endset %}
{{ code_block(code) }}
<h2 id="examples"><a href="#examples">Examples</a></h2>
+13 -9
View File
@@ -21,7 +21,7 @@ toc:
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
{% from "components/select.njk" import select %}
{% from "select.njk" import select %}
{% set options_frameworks = ["Next.js", "SvelteKit", "Nuxt.js", "Remix", "Astro"] %}
{% set code_html %}
@@ -39,7 +39,13 @@ toc:
{% endset %}
{% set code_script %}
{% include "components/select-script.njk" %}
<script>
{% fetchCode "src/js/select.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerSelect(Alpine);
});
</script>
{% endset %}
{{ code_preview("combobox", code_script | prettyHtml ~ code_html | prettyHtml) }}
@@ -56,7 +62,7 @@ toc:
</section>
</div>
<section class="prose my-6">
<section class="prose">
<p>Combobox uses the same Alpine.js code and markup as the <a href="/components/select">Select</a> component, the only difference being the search box at the top of the listbox.</p>
<p>You can set up a few additional options on the <code>&lt;div data-popover&gt;</code> element:</p>
<ul>
@@ -66,18 +72,16 @@ toc:
</ul>
</section>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="combobox", tabsets=tabsets) }}
<h3 id="usage-jinja"><a href="#usage-jinja">Jinja or Nunjucks</a></h3>
<section class="prose my-6">
<p class="my-6 prose">If you use Jinja (or Nunjucks), you can use the <code>select()</code> macro directly, making sure to set <code>is_combobox</code> to <code>True</code> (or <code>true</code> for Nunjucks). <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
</section>
<p class="prose">If you use Jinja (or Nunjucks), you can use the <code>select()</code> macro directly, making sure to set <code>is_combobox</code> to <code>True</code> (or <code>true</code> for Nunjucks). <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
{% set raw_code %}{% raw %}{% call select(
listbox_attrs={"data-empty": "No framework found."},
+15 -9
View File
@@ -19,7 +19,7 @@ toc:
{% from "macros/code_block.njk" import code_block %}
{% from "macros/code_preview.njk" import code_preview %}
{% from "components/dialog.njk" import dialog %}
{% from "dialog.njk" import dialog %}
{% set code_html %}
{% set footer %}
@@ -40,7 +40,7 @@ toc:
<form class="form grid gap-4">
<div class="grid gap-3">
<label for="demo-dialog-edit-profile-name">Name</label>
<input type="text" value="Pedro Duarte" id="demo-dialog-edit-profile-name" />
<input type="text" value="Pedro Duarte" id="demo-dialog-edit-profile-name" x-ref="focusOnOpen" />
</div>
<div class="grid gap-3">
<label for="demo-dialog-edit-profile-username">Username</label>
@@ -51,10 +51,16 @@ toc:
{% endset %}
{% set code_script %}
{% include "components/dialog-script.njk" %}
<script>
{% fetchCode "src/js/dialog.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerDialog(Alpine);
});
</script>
{% endset %}
{{ code_preview("dialog", code_script | prettyHtml ~ code_html | prettyHtml) }}
{{ code_preview("dialog", code_html | prettyHtml) }}
<h2 id="usage"><a href="#usage">Usage</a></h2>
@@ -68,7 +74,7 @@ toc:
</section>
</div>
<section class="prose my-6">
<section class="prose">
<p>The component is structured as such:</p>
<ul>
<li>A <code>&lt;div class="dialog"&gt;</code> which wraps around the entire component and holds it state (e.g. open/close).</li>
@@ -85,16 +91,16 @@ toc:
</ul>
</section>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="combobox", tabsets=tabsets) }}
<h3 id="usage-jinja"><a href="#usage-jinja">Jinja or Nunjucks</a></h3>
<p class="my-6 prose">If you use Jinja (or Nunjucks), you can use the <code>dialog()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
<p class="prose">If you use Jinja (or Nunjucks), you can use the <code>dialog()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
{% set raw_code %}{% raw %}{% set footer %}
<button class="btn-outline" @click="open = false">Cancel</button>
+13 -7
View File
@@ -21,7 +21,7 @@ toc:
{% from "macros/code_block.njk" import code_block %}
{% from "macros/code_preview.njk" import code_preview %}
{% from "components/dropdown-menu.njk" import dropdown_menu %}
{% from "dropdown-menu.njk" import dropdown_menu %}
{% set code_html %}
{% call dropdown_menu(
@@ -69,7 +69,13 @@ toc:
{% endset %}
{% set code_script %}
{% include "components/dropdown-menu-script.njk" %}
<script>
{% fetchCode "src/js/dropdown-menu.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerDropdownMenu(Alpine);
});
</script>
{% endset %}
{{ code_preview("dropdown-menu", code_script | prettyHtml ~ code_html | prettyHtml) }}
@@ -86,7 +92,7 @@ toc:
</section>
</div>
<section class="prose my-6">
<section class="prose">
<p>The component is structured as such:</p>
<ul>
<li>A <code>&lt;div class="popover"&gt;</code> which wraps around the entire component and holds it state (e.g. open/close).</li>
@@ -109,16 +115,16 @@ toc:
</ul>
</section>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="dropdown-menu", tabsets=tabsets) }}
<h3 id="usage-jinja"><a href="#usage-jinja">Jinja or Nunjucks</a></h3>
<p class="my-6 prose">If you use Jinja (or Nunjucks), you can use the <code>dropdown_menu()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
<p class="prose">If you use Jinja (or Nunjucks), you can use the <code>dropdown_menu()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
{% set raw_code %}{% raw %}{% call dropdown_menu(
id="dropdown-menu",
+1 -1
View File
@@ -72,7 +72,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>Adding the <code>form</code> class to the parent of any form element (<code>&lt;label&gt;</code>, <code>&lt;input&gt;</code>, <code>&lt;textarea&gt;</code>, <code>&lt;select&gt;</code>) will automatically apply the style you would get from adding <code>label</code>, <code>input</code>, <code>textarea</code>, or <code>select</code> classes. Read more about <a href="/components/label">Label</a>, <a href="/components/input">Input</a>, <a href="/components/textarea">Textarea</a>, and <a href="/components/select">Select</a>.</p>
</section>
+1 -1
View File
@@ -32,7 +32,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>Simply add the <code>input</code> class to your <code>&lt;input&gt;</code> element or have a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>). You can also set the <code>aria-invalid</code> attribute to <code>true</code> to make the input invalid.</p>
</section>
+1 -1
View File
@@ -23,7 +23,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>Simply add the <code>label</code> class to your <code>&lt;label&gt;</code> element or have a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>). Labels' style may be affected by the presence of a disabled peer or child element.</p>
</section>
+1 -1
View File
@@ -41,7 +41,7 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<section class="prose my-6">
<section class="prose">
<p>A pagination is fairly simple to implement with Tailwind using the Basecoat button classes:</p>
</section>
+15 -9
View File
@@ -14,7 +14,7 @@ toc:
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
{% from "components/popover.njk" import popover %}
{% from "popover.njk" import popover %}
{% set code_html %}
{% call popover(
@@ -52,10 +52,16 @@ toc:
{% endset %}
{% set code_script %}
{% include "components/popover-script.njk" %}
<script>
{% fetchCode "src/js/popover.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerPopover(Alpine);
});
</script>
{% endset %}
{{ code_preview("combobox", code_script | prettyHtml ~ code_html | prettyHtml) }}
{{ code_preview("popover", code_script | prettyHtml ~ code_html | prettyHtml) }}
<h2 id="usage"><a href="#usage">Usage</a></h2>
@@ -69,7 +75,7 @@ toc:
</section>
</div>
<section class="prose my-6">
<section class="prose">
<p>The component is structured as such:</p>
<ul>
<li>A <code>&lt;div class="popover"&gt;</code> which wraps around the entire component and holds it state (e.g. open/close).</li>
@@ -83,17 +89,17 @@ toc:
</ul>
</section>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="popover", tabsets=tabsets) }}
<h3 id="usage-jinja"><a href="#usage-jinja">Jinja or Nunjucks</a></h3>
<section class="prose my-6">
<p class="my-6 prose">If you use Jinja (or Nunjucks), you can use the <code>popover()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
<section class="prose">
<p>If you use Jinja (or Nunjucks), you can use the <code>popover()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
</section>
{% set raw_code %}{% raw %}{% call popover(
+1 -1
View File
@@ -24,7 +24,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>Simply add the <code>input</code> class to your <code>&lt;input type="radio"&gt;</code> elements or have a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>). You can also set the <code>aria-invalid</code> attribute to <code>true</code> to make the input invalid.</p>
</section>
+15 -9
View File
@@ -25,7 +25,7 @@ toc:
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
{% from "components/select.njk" import select %}
{% from "select.njk" import select %}
{% set code_native %}<select class="select w-[180px]">
<optgroup label="Fruits">
@@ -55,16 +55,22 @@ toc:
{% endset %}
{% set code_script %}
{% include "components/select-script.njk" %}
<script>
{% fetchCode "src/js/select.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerSelect(Alpine);
});
</script>
{% endset %}
{{ code_preview("combobox", code_script | prettyHtml ~ code_html | prettyHtml) }}
{{ code_preview("select", code_script | prettyHtml ~ code_html | prettyHtml) }}
<h2 id="usage"><a href="#usage">Usage</a></h2>
<h3 id="usage-html"><a href="#usage-html">HTML</a></h3>
<section class="prose my-6">
<section class="prose">
<p>If you use a <code>&lt;select&gt;</code> element, just add the <code>select</code> class to it or have a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>).</p>
</section>
@@ -80,7 +86,7 @@ toc:
</section>
</div>
<section class="prose my-6">
<section class="prose">
<p>If you need to do more than what <code>&lt;select&gt;</code> allows (e.g. HTML options), you can use this component. It is structured as such:</p>
<ul>
<li>A <code>&lt;div class="popover"&gt;</code> which wraps around the entire component and holds it state (e.g. open/close).</li>
@@ -103,16 +109,16 @@ toc:
</ul>
</section>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="select", tabsets=tabsets) }}
<h3 id="usage-jinja"><a href="#usage-jinja">Jinja or Nunjucks</a></h3>
<p class="my-6 prose">If you use Jinja (or Nunjucks), you can use the <code>dropdown_menu()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
<p class="prose">If you use Jinja (or Nunjucks), you can use the <code>dropdown_menu()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
{% set raw_code %}{% raw %}{% call select(name="select-js") %}
<div role="group" aria-labelledby="fruit-options-label">
+1 -1
View File
@@ -31,7 +31,7 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<p class="prose my-6">Simply use the <code>animate-pulse</code> class to create a skeleton.</p>
<p class="prose">Simply use the <code>animate-pulse</code> class to create a skeleton.</p>
{{ code_block(code) }}
+1 -1
View File
@@ -32,7 +32,7 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<section class="prose my-6">
<section class="prose">
<p>You can style an <code>&lt;input type="range"&gt;</code> element by either adding the <code>input</code> class or having a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>). However, the range input also requries some Javacript code to be able to paint the left side of the slider.</p>
</section>
+1 -1
View File
@@ -23,7 +23,7 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<section class="prose my-6">
<section class="prose">
<p>You can style a <code>&lt;input type="checkbox"&gt;</code> element as a switch by adding a <code>role="switch"</code> attribute, and adding the <code>input</code> class or having a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>).</p>
</section>
+1 -1
View File
@@ -75,7 +75,7 @@ toc:
<h2 id="usage"><a href="#usage">Usage</a></h2>
<section class="prose my-6">
<section class="prose">
<p>Simply add the <code>table</code> class to your table element.</p>
</section>
+13 -7
View File
@@ -14,7 +14,7 @@ toc:
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set code_html %}
{% set account_panel %}
@@ -77,7 +77,13 @@ toc:
{% endset %}
{% set code_script %}
{% include "components/tabs-script.njk" %}
<script>
{% fetchCode "src/js/tabs.js" %}
document.addEventListener('alpine:init', () => {
window.basecoat.registerTabs(Alpine);
});
</script>
{% endset %}
{{ code_preview("tabs", code_script | prettyHtml ~ code_html | prettyHtml, "max-w-[300px] w-full") }}
@@ -94,7 +100,7 @@ toc:
</section>
</div>
<section class="prose my-6">
<section class="prose">
<p>The component is structured as such:</p>
<ul>
<li>A <code>&lt;div class="tabs"&gt;</code> which wraps around the entire component and holds it state (e.g. open/close).</li>
@@ -103,16 +109,16 @@ toc:
</ul>
</section>
{% from "components/tabs.njk" import tabs %}
{% from "tabs.njk" import tabs %}
{% set tabsets = [
{ tab: "HTML", panel: code_block(code_html | prettyHtml) },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml) }
{ tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
{ tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
] %}
{{ tabs(id="combobox", tabsets=tabsets) }}
<h3 id="usage-jinja"><a href="#usage-jinja">Jinja or Nunjucks</a></h3>
<p class="my-6 prose">If you use Jinja (or Nunjucks), you can use the <code>tabs()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
<p class="prose">If you use Jinja (or Nunjucks), you can use the <code>tabs()</code> macro directly. <a href="/installation#jinja-and-nunjucks">Read more about using Basecoat with Jinja and Nunjucks</a>.</p>
{% set raw_code %}{% raw %}{% set account_panel %}
<div class="card">
+1 -1
View File
@@ -32,7 +32,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>Simply add the <code>textarea</code> class to your <code>&lt;textarea&gt;</code> element or have a parent with the <code>form</code> class (<a href="/components/form">read more about form</a>). You can also set the <code>aria-invalid</code> attribute to <code>true</code> to make the textarea invalid.</p>
</section>
+1 -1
View File
@@ -24,7 +24,7 @@ toc:
<h2 id="usage">Usage</h2>
<section class="prose my-6">
<section class="prose">
<p>On any element, set the value of the <code>data-tooltip</code> attribute to the text you want to display in the tooltip. Additionally, you can set:</p>
<ul>
<li><code>data-side</code> attribute to <code>top</code>, <code>bottom</code>, <code>left</code>, or <code>right</code> to change the side of the tooltip.</li>