Expand description
Rink
A beautiful terminal user interfaces library in Rust.
Leverage CSS, HTML, and Rust to build beautiful, portable, terminal user interfaces. Rink is the cross-framework library that powers Dioxus-TUI
Background
You can use Html-like semantics with inline styles, tree hierarchy, components, and more in your text-based user interface (TUI)
application.
Rink is essentially a port of Ink but for Rust
. Rink doesn’t depend on Node.js or any other JavaScript runtime, so your binaries are portable and beautiful.
Limitations
- Subset of Html Terminals can only render a subset of HTML. We support as much as we can.
- Particular frontend design Terminals and browsers are and look different. Therefore, the same design might not be the best to cover both renderers.
Status
WARNING: Rink is currently under construction!
Rendering a Dom works fine, but the ecosystem of widgets is not ready yet. Additionally, some bugs in the flexbox implementation might be quirky at times.
Features
Rink features:
- Flexbox-based layout system
- CSS selectors
- inline CSS support
- Built-in focusing system
- Widgets
- Support for events, hooks, and callbacks1
- Html tags2
1 Basic keyboard, mouse, and focus events are implemented.
2 Currently, most HTML tags don’t translate into any meaning inside of Rink. So an input
element won’t mean anything nor does it have any additional functionality.
Re-exports
pub use query::Query;
Modules
Structs
- The final result of a layout algorithm for a single
Node
. - An abstract “line”. Represents any type that has a start and an end
- A 2-dimensional coordinate.
- An axis-aligned UI rectangle
- The width and height of a
Rect
- The flexbox layout information for a single
Node
. - A tree of UI
Nodes
, suitable for UI layout
Enums
- Sets the distribution of space between and around content items For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
- Used to control how child
Nodes
are aligned. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis - The amount of space available to a node in a given axis https://www.w3.org/TR/css-sizing-3/#available
- A unit of linear measurement
- Sets the layout used for the children of this node
- The direction of the flexbox layout main axis.
- Controls whether flex items are forced onto one line or can wrap onto multiple lines.
- Controls whether grid items are placed row-wise or column-wise. And whether the sparse or dense packing algorithm is used.
- The first argument to a repeated track definition. This type represents the type of automatic repetition to perform.
- A unit of linear measurement
- A unit of linear measurement
- Maximum track sizing function
- Minimum track sizing function
- The positioning strategy for this item.
- The sizing function for a grid track (row/column) See https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns
Traits
- Trait to create constant percent values from plain numbers
- Trait to create constant percent values from plain numbers
- Trait to create constant points values from plain numbers
- Any item that implements the LayoutTree can be layed out using Taffy’s algorithms.
- Trait to abstract over auto values
- Trait to create constant points values from plain numbers
- Trait to abstract over grid line values
- Trait to abstract over grid span values
- Trait to abstract over max_content values
- Trait to abstract over min_content values
- Trait to abstract over zero values
Functions
- Returns the auto value for that type
- Returns a grid template containing
count
evenly sized tracks - Returns a value of the inferred type which represent a constant of points
- Shorthand for minmax(0, Nfr). Probably what you want if you want exactly evenly sized tracks.
- Create a
Fraction
track sizing function (fr
in CSS) - Apply the flexbox algorithm and recursively layout the specified node
- Specifies a grid line to place a grid item between in CSS Grid Line coordinates:
- Returns the auto value for that type
- Returns the auto value for that type
- Returns a MinMax with min value of min and max value of max
- Returns a value of the inferred type which represent a constant of points
- Returns a value of the inferred type which represent a constant of points
- Returns an auto-repeated track definition
- Returns a GridPlacement::Span
- Returns the zero value for that type
Type Aliases
- Used to control how the specified
Nodes
is aligned. Overrides the parent Node’sAlignItems
property. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis - A grid line placement specification. Used for grid-[row/column]-[start/end]. Named tracks are not implemented.
- Sets the distribution of space between and around content items For Flexbox it controls alignment in the main axis For Grid it controls alignment in the inline axis
- Used to control how child
Nodes
are aligned. Does not apply to Flexbox, and will be ignored if specified on a flex container For Grid it controls alignment in the inline axis - Used to control how the specified
Nodes
is aligned. Overrides the parent Node’sJustifyItems
property. Does not apply to Flexbox, and will be ignored if specified on a flex child For Grid it controls alignment in the inline axis - A node in a layout.
- The sizing function for a grid track (row/column) (either auto-track or template track) May either be a MinMax variant which specifies separate values for the min-/max- track sizing functions or a scalar value which applies to both track sizing functions.