 Search
components/badge: Badge components/button: Button components/checkbox: Checkbox components/dialog: Dialog components/input: Input components/popover: Popover components/pre: Pre components/progress: Progress components/radio: Radio components/range: Range components/separator: Separator components/spinner: Spinner components/switch: Switch components/table: Table components/textarea: Textarea components/tooltip: Tooltip components/typography: Typography components/view: View plugins/plugin-nf: Nerd Font Plugin plugins/theme-catppuccin: Catppuccin Theme plugins/theme-everforest: Everforest Theme plugins/theme-gruvbox: Gruvbox Theme plugins/theme-nord: Nord Theme plugins/theme-vitesse: Vitesse Theme start/ascii-boxes: ASCII Boxes start/changelog: Changelog 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/theming: ### Using Multiple Theme Accents 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

View

Displays a TUI-accurate view that automatically rounds its width and height to the nearest ch and lh units respectively

Useful for building tiled UIs or a partial GUI/TUI application

1 <div class="tile" is-="view">
2 <div is-="view-content">root@Macbook-Pro ~# yes no<br/>no<br/>no<br/>no<br/>no<br/>no<br/>no<br/>no<br/>no<br/>no<br/>no<br/>no<br/></div>
3 </div>
4 <div class="tile" is-="view">
5 <div is-="view-content">root@Macbook-Pro ~# emacs<br/>zsh: command not found: emacs</div>
6 </div>
1
2 body {
3 display: flex;
4 flex-direction: row;
5 flex-grow: 1;
6 padding-left: 10px;
7 padding-right: 10px;
8 padding-top: 10px;
9 padding-bottom: 10px;
10 gap: 10px;
11 background: linear-gradient(45deg, #5f5ba5, #8c59a5);
12 height: 100vh;
13 animation: pad 5s infinite linear;
14 }
15 .tile {
16 flex: 1 1 0;
17 background: rgba(0, 0, 0, 0.5);
18 border-radius: 10px;
19 }
20 [is-='view-content'] {
21 background: rgba(0, 0, 0, 0.5);
22 color: white;
23 }
24 @keyframes pad {
25 0% {
26 padding-left: 10px;
27 padding-right: 10px;
28 padding-top: 10px;
29 padding-bottom: 10px;
30 gap: 10px;
31 }
32 25% {
33 padding-left: 50px;
34 padding-right: 50px;
35 padding-top: 10px;
36 padding-bottom: 10px;
37 gap: 50px;
38 }
39 50% {
40 padding-left: 10px;
41 padding-right: 10px;
42 padding-top: 10px;
43 padding-bottom: 10px;
44 gap: 10px;
45 }
46 75% {
47 padding-left: 10px;
48 padding-right: 10px;
49 padding-top: 50px;
50 padding-bottom: 50px;
51 gap: 10px;
52 }
53 100% {
54 padding-left: 10px;
55 padding-right: 10px;
56 padding-top: 10px;
57 padding-bottom: 10px;
58 gap: 10px;
59 }
60 }
61

Import

@import '@webtui/css/components/view.css';

Usage

<div is-="view">
    <div is-="view-content">
        <!-- TUI contents -->
    </div>
</div>

Examples

Basic usage

1 <div is-="view" id="view-outer">
2 <div is-="view-content" id="view-inner">root@Macbook-Pro ~# cowsay moÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖoÖ</div>
3 </div>
1
2 body {
3 height: 100vh;
4 display: flex;
5 flex-direction: column;
6 background: var(--background1);
7 }
8 #view-outer {
9 flex: 1 1 0;
10 }
11 #view-inner {
12 background: var(--background2);
13 }
14

Reference

Extending

To extend the View stylesheet, define a CSS rule on the components layer

@layer components {
    [is-~='view'] {
        /* ... */
    }

    [is-~='view-content'] {
        /* ... */
    }
}