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§
- Config
- Event
- File
- Files
- Form
Data - Inner
Input State - Layout
- The final result of a layout algorithm for a single
Node. - Line
- An abstract “line”. Represents any type that has a start and an end
- Point
- A 2-dimensional coordinate.
- Rect
- An axis-aligned UI rectangle
- Rink
Input Handler - Size
- The width and height of a
Rect - Style
- The flexbox layout information for a single
Node. - Taffy
- A tree of UI
Nodes, suitable for UI layout - TuiContext
Enums§
- Align
Content - 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
- Align
Items - Used to control how child
Nodesare aligned. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis - Available
Space - The amount of space available to a node in a given axis https://www.w3.org/TR/css-sizing-3/#available
- Dimension
- A unit of linear measurement
- Display
- Sets the layout used for the children of this node
- Event
Data - Flex
Direction - The direction of the flexbox layout main axis.
- Flex
Wrap - Controls whether flex items are forced onto one line or can wrap onto multiple lines.
- Grid
Auto Flow - Controls whether grid items are placed row-wise or column-wise. And whether the sparse or dense packing algorithm is used.
- Grid
Track Repetition - The first argument to a repeated track definition. This type represents the type of automatic repetition to perform.
- Input
Event - Length
Percentage - A unit of linear measurement
- Length
Percentage Auto - A unit of linear measurement
- MaxTrack
Sizing Function - Maximum track sizing function
- MinTrack
Sizing Function - Minimum track sizing function
- Position
- The positioning strategy for this item.
- Rendering
Mode - Track
Sizing Function - The sizing function for a grid track (row/column) See https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns
Traits§
- Driver
- From
Flex - Trait to create constant percent values from plain numbers
- From
Percent - Trait to create constant percent values from plain numbers
- From
Points - Trait to create constant points values from plain numbers
- Layout
Tree - Any item that implements the LayoutTree can be layed out using Taffy’s algorithms.
- Taffy
Auto - Trait to abstract over auto values
- Taffy
FitContent - Trait to create constant points values from plain numbers
- Taffy
Grid Line - Trait to abstract over grid line values
- Taffy
Grid Span - Trait to abstract over grid span values
- Taffy
MaxContent - Trait to abstract over max_content values
- Taffy
MinContent - Trait to abstract over min_content values
- Taffy
Zero - Trait to abstract over zero values
Functions§
- auto
- Returns the auto value for that type
- evenly_
sized_ tracks - Returns a grid template containing
countevenly sized tracks - fit_
content - Returns a value of the inferred type which represent a constant of points
- flex
- Shorthand for minmax(0, Nfr). Probably what you want if you want exactly evenly sized tracks.
- fr
- Create a
Fractiontrack sizing function (frin CSS) - layout_
flexbox - Apply the flexbox algorithm and recursively layout the specified node
- line
- Specifies a grid line to place a grid item between in CSS Grid Line coordinates:
- max_
content - Returns the auto value for that type
- min_
content - Returns the auto value for that type
- minmax
- Returns a MinMax with min value of min and max value of max
- percent
- Returns a value of the inferred type which represent a constant of points
- points
- Returns a value of the inferred type which represent a constant of points
- render
- repeat
- Returns an auto-repeated track definition
- span
- Returns a GridPlacement::Span
- zero
- Returns the zero value for that type
Type Aliases§
- Align
Self - Used to control how the specified
Nodesis aligned. Overrides the parent Node’sAlignItemsproperty. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis - Grid
Placement - A grid line placement specification. Used for grid-[row/column]-[start/end]. Named tracks are not implemented.
- Justify
Content - 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
- Justify
Items - Used to control how child
Nodesare 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 - Justify
Self - Used to control how the specified
Nodesis aligned. Overrides the parent Node’sJustifyItemsproperty. Does not apply to Flexbox, and will be ignored if specified on a flex child For Grid it controls alignment in the inline axis - Node
- A node in a layout.
- NonRepeated
Track Sizing Function - 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.