# Components


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

``` python
p = mk_previewer()
```

## Anchors

The `c-anchor` component styles links with Garden’s typography and color
system.

### Basic Usage

``` python
p(Anchor('Click here', href='#'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_JLoVjqmaT_KpS2cQ3J5K9w&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
&lt;a href=&quot;#&quot; class=&quot;c-anchor  &quot;&gt;Click here&lt;/a&gt;     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Danger

``` python
p(Anchor('Delete this', href='#', cls='--danger'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_lNy2CoKlRv2lQVrZL3xXbQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
&lt;a href=&quot;#&quot; class=&quot;c-anchor c-anchor--danger &quot;&gt;Delete this&lt;/a&gt;     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Dark

For use on dark backgrounds.

``` python
p(Div(Anchor('Dark link', href='#', cls='--dark'), style='background:#333; padding:1rem'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_bBBrmSWXQB6Eu9pZ5Vpczw&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;background:#333; padding:1rem&quot;&gt;
&lt;a href=&quot;#&quot; class=&quot;c-anchor c-anchor--dark &quot;&gt;Dark link&lt;/a&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

## Avatars

Styled avatar images with Garden’s sizing and shape system.

### Basic Usage

An Avatar can contain an image or text

``` python
p(Avatar(Img(src='https://ui-avatars.com/api/?name=John+Doe')))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_Ocl5NnyySQyfDkCUF5IboQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
&lt;figure class=&quot;c-avatar  &quot;&gt;&lt;img src=&quot;https://ui-avatars.com/api/?name=John+Doe&quot;&gt;&lt;/figure&gt;     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

``` python
p(Div(
    Avatar(Img(src='https://picsum.photos/200')),
    Avatar(AvatarTxt('ZD'), style='background:var(--zd-color-secondary-royal-700)'),
    style='display:flex; gap:1rem; align-items:center'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/__aJYCcBcTdyOFOeGzwodFg&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;display:flex; gap:1rem; align-items:center&quot;&gt;
&lt;figure class=&quot;c-avatar  &quot;&gt;&lt;img src=&quot;https://picsum.photos/200&quot;&gt;&lt;/figure&gt;&lt;figure class=&quot;c-avatar  &quot; style=&quot;background:var(--zd-color-secondary-royal-700)&quot;&gt;&lt;span class=&quot;c-avatar__txt  &quot;&gt;ZD&lt;/span&gt;&lt;/figure&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

``` python
print(Avatar(Span('ZD', cls='c-avatar__txt', style='background:--zd-color-secondary-royal-700'), cls='--system'))
```

    <figure class="c-avatar c-avatar--system "><span class="c-avatar__txt" style="background:--zd-color-secondary-royal-700">ZD</span></figure>

### Sizes

Avatars come in extra-small, small, default, and large sizes.

``` python
p(Div(
    Avatar(Img(src='https://ui-avatars.com/api/?name=XS'), cls='--xs'),
    Avatar(Img(src='https://ui-avatars.com/api/?name=SM'), cls='--sm'),
    Avatar(Img(src='https://ui-avatars.com/api/?name=MD')),
    Avatar(Img(src='https://ui-avatars.com/api/?name=LG'), cls='--lg')
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_41-oTXRWTPi-jJ6uvef16A&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div&gt;
&lt;figure class=&quot;c-avatar c-avatar--xs &quot;&gt;&lt;img src=&quot;https://ui-avatars.com/api/?name=XS&quot;&gt;&lt;/figure&gt;&lt;figure class=&quot;c-avatar c-avatar--sm &quot;&gt;&lt;img src=&quot;https://ui-avatars.com/api/?name=SM&quot;&gt;&lt;/figure&gt;&lt;figure class=&quot;c-avatar  &quot;&gt;&lt;img src=&quot;https://ui-avatars.com/api/?name=MD&quot;&gt;&lt;/figure&gt;&lt;figure class=&quot;c-avatar c-avatar--lg &quot;&gt;&lt;img src=&quot;https://ui-avatars.com/api/?name=LG&quot;&gt;&lt;/figure&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### System

Square avatars for system/product icons.

``` python
p(Avatar(Img(src='https://ui-avatars.com/api/?name=SYS'), cls='--system'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_7ur_E5IdSf_E3bgs8luw2w&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
&lt;figure class=&quot;c-avatar c-avatar--system &quot;&gt;&lt;img src=&quot;https://ui-avatars.com/api/?name=SYS&quot;&gt;&lt;/figure&gt;     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Dark

For use on dark backgrounds.

``` python
p(Div(Avatar(Img(src='https://ui-avatars.com/api/?name=DK'), cls='--dark'), style='background:#333; padding:1rem'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_bvkp8l2cQ02M7fWuh1gLyA&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;background:#333; padding:1rem&quot;&gt;
&lt;figure class=&quot;c-avatar c-avatar--dark &quot;&gt;&lt;img src=&quot;https://ui-avatars.com/api/?name=DK&quot;&gt;&lt;/figure&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

## Buttons

Styled buttons with Garden’s button system.

### Basic Usage

``` python
p(Div(
    Btn('Standard'),
    Btn('Basic', cls='--basic'),
    Btn('Pill', cls='--pill'),
    style='display:flex; gap:1rem; align-items:center'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_24qwXWmlQ0aLkIkUaG6GGA&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;display:flex; gap:1rem; align-items:center&quot;&gt;
&lt;button class=&quot;c-btn  &quot;&gt;Standard&lt;/button&gt;&lt;button class=&quot;c-btn c-btn--basic &quot;&gt;Basic&lt;/button&gt;&lt;button class=&quot;c-btn c-btn--pill &quot;&gt;Pill&lt;/button&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Primary

``` python
p(Btn('Primary', cls='--primary'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_lwqCxRaLTumtg1GUICKsAg&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
&lt;button class=&quot;c-btn c-btn--primary &quot;&gt;Primary&lt;/button&gt;     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Danger

``` python
p(Btn('Delete', cls='--danger'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_hbPaA2Q7RB2HCcY2Ja5zjw&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
&lt;button class=&quot;c-btn c-btn--danger &quot;&gt;Delete&lt;/button&gt;     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Full Width

``` python
p(Btn('Full Width', cls='--full'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_lSLGOGHzRDivBgGRyanFww&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
&lt;button class=&quot;c-btn c-btn--full &quot;&gt;Full Width&lt;/button&gt;     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Sizes

``` python
p(Div(Btn('Small', cls='--sm'), Btn('Default'), Btn('Large', cls='--lg'), style='display:flex; gap:1rem; align-items:center'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_oS3FuyaUTkmO0N9SKxdx7Q&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;display:flex; gap:1rem; align-items:center&quot;&gt;
&lt;button class=&quot;c-btn c-btn--sm &quot;&gt;Small&lt;/button&gt;&lt;button class=&quot;c-btn  &quot;&gt;Default&lt;/button&gt;&lt;button class=&quot;c-btn c-btn--lg &quot;&gt;Large&lt;/button&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Dark

For use on dark backgrounds.

``` python
p(Div(Btn('Dark', cls='--dark'), style='background:#333; padding:1rem'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_qIQBxpDNSH_7UO2df47o5g&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;background:#333; padding:1rem&quot;&gt;
&lt;button class=&quot;c-btn c-btn--dark &quot;&gt;Dark&lt;/button&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Combinations

``` python
p(Div(Btn('Primary Pill', cls='--primary --pill'), Btn('Danger Large', cls='--danger --lg'), style='display:flex; gap:1rem'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_xjcHatkGT06R3uSQZtXYVg&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;display:flex; gap:1rem&quot;&gt;
&lt;button class=&quot;c-btn c-btn--primary c-btn--pill &quot;&gt;Primary Pill&lt;/button&gt;&lt;button class=&quot;c-btn c-btn--danger c-btn--lg &quot;&gt;Danger Large&lt;/button&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

## Forms

Garden forms combine inputs with labels, hints, and validation messages
inside a `c-field` container.

### Basic Usage

### Text Input

``` python
p(Field(
    FieldLabel('Name', fr='name-id'),
    FieldHint('Enter your full name'),
    FieldInput(id='name-id', placeholder='John Doe')
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_6PPauCFFSSq7KfI09JLKpQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field  &quot;&gt;
&lt;label for=&quot;name-id&quot; class=&quot;c-field__label  &quot;&gt;Name&lt;/label&gt;         &lt;div class=&quot;c-field__hint  &quot;&gt;Enter your full name&lt;/div&gt;
         &lt;input placeholder=&quot;John Doe&quot; id=&quot;name-id&quot; class=&quot;c-field__input  &quot; name=&quot;name-id&quot;&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Textarea

``` python
p(Field(
    FieldLabel('Bio', fr='bio-id'),
    Textarea(id='bio-id', placeholder='Tell us about yourself')
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_hBFpKHiCRbe8N1pdzXO1CQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field  &quot;&gt;
&lt;label for=&quot;bio-id&quot; class=&quot;c-field__label  &quot;&gt;Bio&lt;/label&gt;&lt;textarea placeholder=&quot;Tell us about yourself&quot; id=&quot;bio-id&quot; class=&quot;c-field__input  c-field__input--area&quot; name=&quot;bio-id&quot;&gt;&lt;/textarea&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Select

``` python
p(Field(
    FieldLabel('Country', fr='country-id'),
    Select(Option('USA'), Option('UK'), Option('Canada'), id='country-id')
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_seVJhdItQbO4rRJ2GFVqbQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field  &quot;&gt;
&lt;label for=&quot;country-id&quot; class=&quot;c-field__label  &quot;&gt;Country&lt;/label&gt;&lt;select id=&quot;country-id&quot; class=&quot;c-field__input  c-field__input--select&quot; name=&quot;country-id&quot;&gt;&lt;option&gt;USA&lt;/option&gt;&lt;option&gt;UK&lt;/option&gt;&lt;option&gt;Canada&lt;/option&gt;&lt;/select&gt;       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Checkbox

``` python
p(Field(
    Checkbox(id='agree-id'),
    FieldLabel('I agree to the terms', fr='agree-id'),
    FieldHint('Please read carefully')
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_QSjip669TUii5DUaZKH9UQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field  &quot;&gt;
         &lt;input type=&quot;checkbox&quot; id=&quot;agree-id&quot; class=&quot;c-field__checkbox  &quot; name=&quot;agree-id&quot;&gt;
&lt;label for=&quot;agree-id&quot; class=&quot;c-field__label  &quot;&gt;I agree to the terms&lt;/label&gt;         &lt;div class=&quot;c-field__hint  &quot;&gt;Please read carefully&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Radio

``` python
p(Div(
    Field(Radio(id='opt1', name='options'), FieldLabel('Option 1', fr='opt1')),
    Field(Radio(id='opt2', name='options'), FieldLabel('Option 2', fr='opt2')),
    Field(Radio(id='opt3', name='options'), FieldLabel('Option 3', fr='opt3'))
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_EegCPNZjRyOzApRayhGFGQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div&gt;
         &lt;div class=&quot;c-field  &quot;&gt;
           &lt;input type=&quot;radio&quot; name=&quot;options&quot; id=&quot;opt1&quot; class=&quot;c-field__radio  &quot;&gt;
&lt;label for=&quot;opt1&quot; class=&quot;c-field__label  &quot;&gt;Option 1&lt;/label&gt;         &lt;/div&gt;
         &lt;div class=&quot;c-field  &quot;&gt;
           &lt;input type=&quot;radio&quot; name=&quot;options&quot; id=&quot;opt2&quot; class=&quot;c-field__radio  &quot;&gt;
&lt;label for=&quot;opt2&quot; class=&quot;c-field__label  &quot;&gt;Option 2&lt;/label&gt;         &lt;/div&gt;
         &lt;div class=&quot;c-field  &quot;&gt;
           &lt;input type=&quot;radio&quot; name=&quot;options&quot; id=&quot;opt3&quot; class=&quot;c-field__radio  &quot;&gt;
&lt;label for=&quot;opt3&quot; class=&quot;c-field__label  &quot;&gt;Option 3&lt;/label&gt;         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Validation States

``` python
p(Field(
    FieldLabel('Email'), FieldInput(),
    FieldMessage('Valid email', cls='--success'),
    cls='--success'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_wczXn_G0Q9ysw2KU2ODtaQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field c-field--success &quot;&gt;
&lt;label class=&quot;c-field__label  &quot;&gt;Email&lt;/label&gt;         &lt;input class=&quot;c-field__input  &quot;&gt;
         &lt;div class=&quot;c-field__message c-field__message--success &quot;&gt;Valid email&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

``` python
p(Field(
    FieldLabel('Password'), FieldInput(type='password'),
    FieldMessage('Password too weak', cls='--warning'),
    cls='--warning'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/__jFeSFMMTgCoyoQhi450Ng&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field c-field--warning &quot;&gt;
&lt;label class=&quot;c-field__label  &quot;&gt;Password&lt;/label&gt;         &lt;input type=&quot;password&quot; class=&quot;c-field__input  &quot;&gt;
         &lt;div class=&quot;c-field__message c-field__message--warning &quot;&gt;Password too weak&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

``` python
p(Field(
    FieldLabel('Username'), FieldInput(),
    FieldMessage('Username is required', cls='--error'),
    cls='--error'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_pq0lyNLtQSmvLHgTFrhCPA&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field c-field--error &quot;&gt;
&lt;label class=&quot;c-field__label  &quot;&gt;Username&lt;/label&gt;         &lt;input class=&quot;c-field__input  &quot;&gt;
         &lt;div class=&quot;c-field__message c-field__message--error &quot;&gt;Username is required&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Compact and Dark

``` python
p(Field(FieldLabel('Compact'), FieldInput(), cls='--compact'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_nqjcy4FaQt2uI9hI77gmHA&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-field c-field--compact &quot;&gt;
&lt;label class=&quot;c-field__label  &quot;&gt;Compact&lt;/label&gt;         &lt;input class=&quot;c-field__input  &quot;&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

``` python
p(Div(
    Field(FieldLabel('Dark mode'), FieldInput(), cls='--dark'),
    style='background:#333; padding:1rem'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_9oQ_lBSISdystVbJbREIlw&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;background:#333; padding:1rem&quot;&gt;
         &lt;div class=&quot;c-field c-field--dark &quot;&gt;
&lt;label class=&quot;c-field__label  &quot;&gt;Dark mode&lt;/label&gt;           &lt;input class=&quot;c-field__input  &quot;&gt;
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

## Tags

Styled tags for badges, pills, and labels using Garden’s tag system.

### Basic Usage

### Shapes

Tags come in default (rounded rectangle), pill, and round shapes.

``` python
p(Div(
    Tag('Default'),
    Tag('Pill', cls='--pill'),
    Tag('R', cls='--round'),
    style='display:flex; gap:1rem'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_-rZ105mvQ7m0PqIP-HdsrQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;display:flex; gap:1rem&quot;&gt;
         &lt;div class=&quot;c-tag  &quot;&gt;Default&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--pill &quot;&gt;Pill&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--round &quot;&gt;R&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Sizes

``` python
p(Div(
    Tag('Small', cls='--sm'),
    Tag('Default'),
    Tag('Large', cls='--lg'),
    style='display:flex; gap:1rem; align-items:center'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_LK0hc1MBRcS5y6o4oTCQ3A&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;display:flex; gap:1rem; align-items:center&quot;&gt;
         &lt;div class=&quot;c-tag c-tag--sm &quot;&gt;Small&lt;/div&gt;
         &lt;div class=&quot;c-tag  &quot;&gt;Default&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--lg &quot;&gt;Large&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Colors

``` python
p(Div(
    Tag('Blue', cls='--blue'),
    Tag('Green', cls='--green'),
    Tag('Grey', cls='--grey'),
    Tag('Kale', cls='--kale'),
    Tag('Red', cls='--red'),
    Tag('Yellow', cls='--yellow'),
    style='display:flex; gap:0.5rem; flex-wrap:wrap'
))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_QJy6QSZETqeb4cO0oDlhUQ&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;display:flex; gap:0.5rem; flex-wrap:wrap&quot;&gt;
         &lt;div class=&quot;c-tag c-tag--blue &quot;&gt;Blue&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--green &quot;&gt;Green&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--grey &quot;&gt;Grey&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--kale &quot;&gt;Kale&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--red &quot;&gt;Red&lt;/div&gt;
         &lt;div class=&quot;c-tag c-tag--yellow &quot;&gt;Yellow&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### Dark

For use on dark backgrounds.

``` python
p(Div(Tag('Dark', cls='--dark'), style='background:#333; padding:1rem'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_zADEZirPRVmpG4sNlCSTMA&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div style=&quot;background:#333; padding:1rem&quot;&gt;
         &lt;div class=&quot;c-tag c-tag--dark &quot;&gt;Dark&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 

### With Avatar

Tags can include an avatar image.

``` python
p(Tag(TagAvatar(src='https://ui-avatars.com/api/?name=JD&size=32'), 'With Avatar'))
```

<iframe srcdoc=" &lt;!doctype html&gt;
 &lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;FastHTML page&lt;/title&gt;
     &lt;link rel=&quot;canonical&quot; href=&quot;https://testserver/_KBSbhxUwRiONeBaD3XtHFg&quot;&gt;
     &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.12/fasthtml.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js&quot;&gt;&lt;/script&gt;     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-bedrock@^10/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-variables@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-buttons@^9/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-forms@^8/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-tags@^6/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-avatars@^7/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
     &lt;link href=&quot;https://cdn.jsdelivr.net/npm/@zendeskgarden/css-anchors@^1/dist/index.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script&gt;
    function sendmsg() {
        window.parent.postMessage({height: document.documentElement.offsetHeight}, &#x27;*&#x27;);
    }
    window.onload = function() {
        sendmsg();
        document.body.addEventListener(&#x27;htmx:afterSettle&#x27;,    sendmsg);
        document.body.addEventListener(&#x27;htmx:wsAfterMessage&#x27;, sendmsg);
    };&lt;/script&gt;   &lt;/head&gt;
   &lt;body&gt;
     &lt;div class=&quot; &quot;&gt;
       &lt;div class=&quot;c-tag  &quot;&gt;
&lt;img src=&quot;https://ui-avatars.com/api/?name=JD&amp;amp;size=32&quot; class=&quot;c-tag__avatar  &quot;&gt;With Avatar       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
" style="width: 100%; height: auto; border: none;" onload="{
        let frame = this;
        window.addEventListener('message', function(e) {
            if (e.source !== frame.contentWindow) return; // Only proceed if the message is from this iframe
            if (e.data.height) frame.style.height = (e.data.height+1) + 'px';
        }, false);
    }" allow="accelerometer; autoplay; camera; clipboard-read; clipboard-write; display-capture; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; identity-credentials-get; idle-detection; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; usb; web-share; xr-spatial-tracking"></iframe> 
