 Search
components/badge: Badge components/button: Button components/checkbox: Checkbox components/dialog: Dialog components/input: Input components/popover: Popover components/pre: Pre components/radio: Radio components/separator: Separator components/switch: Switch components/table: Table components/textarea: Textarea components/tooltip: Tooltip components/typography: Typography plugins/plugin-nf: Nerd Font Plugin plugins/theme-catppuccin: Catppuccin Theme plugins/theme-gruvbox: Gruvbox Theme plugins/theme-nord: Nord Theme start/changelog: Changelog start/ascii-boxes: ASCII Boxes start/intro: Introduction start/intro: ## Features start/plugins: Plugins start/plugins: ## Official Plugins start/plugins: ### Themes start/plugins: ## Community Plugins contributing/contributing: Contributing contributing/contributing: ## Local Development contributing/contributing: ## Issues contributing/contributing: ## Pull Requests contributing/style-guide: Style Guide contributing/style-guide: ## CSS Units contributing/style-guide: ## Selectors contributing/style-guide: ## Documentation plugins/plugin-dev: Developing Plugins plugins/plugin-dev: ### Style Layers start/tuis-vs-guis: TUIs vs GUIs start/tuis-vs-guis: ## Monospace Fonts start/tuis-vs-guis: ## Character Cells installation/nextjs: Next.js installation/vite: Vite start/theming: Theming start/theming: ## CSS Variables start/theming: ### Font Styles start/theming: ### Colors start/theming: ### Light & Dark start/theming: ## Theme Plugins start/installation: Installation start/installation: ## Installation start/installation: ## Using CSS start/installation: ## Using ESM start/installation: ## Using a CDN start/installation: ## Full Library Import start/installation: ### CSS start/installation: ### ESM start/installation: ### CDN installation/astro: Astro installation/astro: ## Scoping installation/astro: ### Frontmatter Imports installation/astro: ### <style> tag installation/astro: ### Full Library Import

ASCII Boxes

The box- utility utilizes CSS ::before and ::after pseudo-elements to mimic a boxes drawn with ASCII Box-drawing characters

<div box-="square" shear-="both">
  <div class="header">
      <span is-="badge" variant-="background0">top-left</span>
      <span is-="badge" variant-="background0">top-right</span>
  </div>
  <div id="content">
      <p>Lorem ipsum dolor sit amet sit dolor ipsum lorem idk i dont speak french</p>
      <div id="buttons">
          <button box-="round">Cancel</button>
          <button box-="round">Ok</button>
      </div>
  </div>
  <div class="header">
      <span is-="badge" variant-="background0">bottom-left</span>
      <span is-="badge" variant-="background0">bottom-right</span>
  </div>
</div>
.header { 
  display: flex;
  justify-content: space-between; 
}
#content { 
  padding: 0lh 1ch;
  padding-top: 1lh;
  display: flex;
  flex-direction: column;
  gap: 1lh;
}
#buttons { 
  display: flex; 
  justify-content: flex-end; 
}

Import

@import "@webtui/css/utils/box.css";

Usage

<div box-="square">
  Hi Mom
</div>

Important: The box- utility is suffixed with a -

Using box="..." will not work

Examples

Border Types

<div box-="square">Square</div>
<div box-="round">Round</div>
<div box-="double">Double</div>
<div box-="double round">Double + Round</div>

Shearing

Shearing off top/bottom padding allows overlaying content over the top and/or bottom edges of the box

<!-- Shear off the top edge's padding -->
<div box-="square" shear-="top">
  <div class="header">
      <span>Left</span>
      <span>Right</span>
  </div>
  Caption on Top
</div>

<!-- Shear off the bottom edge's padding -->
<div box-="square" shear-="bottom">
  Caption on Bottom
  <div class="header">
      <span>Left</span>
      <span>Right</span>
  </div>
</div>

<!-- Shear off the padding of both top & bottom edges -->
<div box-="square" shear-="both">
  <div class="header">
      <span>Left</span>
      <span>Right</span>
  </div>
  Caption on Top and Bottom
  <div class="header">
      <span>Left</span>
      <span>Right</span>
  </div>
</div>
.header { 
      display: flex;
      justify-content: space-between; 
}
span {
  background-color: var(--background0);
  padding: 0 1ch;
}

Reference

Properties

  • --box-border-color: The border color of the box
  • --box-rounded-radius: The border radius of round boxes
  • --box-border-width: The border width for square and round boxes
  • --box-double-border-width: The width of boxes with double borders
#my-box {
    --box-border-color: cyan;
    --box-rounded-radius: 8px;
    --box-border-width: 1px;
    --box-double-border-width: 1px;
}

Extending

To extend the Box stylesheet, define a CSS rule on the utils layer

@layer utils {
    [box-~="square"], 
    [box-~="round"],
    [box-~="double"] {
        /* ... */
    }
}