Documentation
¶
Overview ¶
Package termiwind provides Tailwind-like styling for terminal output.
Example:
fmt.Print(ti.Style("flex gap-2",
ti.Style("bg-green-600 px-1", "Termwind"),
ti.Style("italic", "CLI styling"),
).Render())
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Layout ¶
Layout calculates positions and dimensions for all nodes in the tree. This is optional - Render calls Layout automatically with default 80x24. Use Layout explicitly when you need custom dimensions.
Example:
node := Style("flex gap-2",
Style("bold", "Hello"),
Style("italic", "World"),
)
Layout(node, 120, 40) // Custom terminal size
fmt.Print(node.Render())
Types ¶
type Node ¶
Node is a styled element in the render tree. Can be a leaf node (with text) or a container (with children).
func Style ¶
Style creates a new Node with the given classes and children. Children can be strings (text content) or *Node (child elements).
Example:
// Leaf node with text
fmt.Print(Style("bold text-red-500", "Hello").Render())
// Container with children
fmt.Print(Style("flex gap-2",
Style("bg-green-600", "Item 1"),
Style("bg-blue-600", "Item 2"),
).Render())
Directories
¶
| Path | Synopsis |
|---|---|
|
Package buffer provides a 2D cell-based buffer for terminal rendering.
|
Package buffer provides a 2D cell-based buffer for terminal rendering. |
|
cmd
|
|
|
repl/examples/border
command
|
|
|
repl/examples/color
command
|
|
|
repl/examples/spacing
command
|
|
|
repl/examples/text
command
|
|
|
repl/examples/width
command
|
|
|
Package node provides a tree-based structure for terminal UI composition.
|
Package node provides a tree-based structure for terminal UI composition. |
|
Package style provides Tailwind CSS-inspired style parsing for terminal UI rendering.
|
Package style provides Tailwind CSS-inspired style parsing for terminal UI rendering. |
Click to show internal directories.
Click to hide internal directories.