[go: up one dir, main page]

ratatui

Module widgets

Source
Expand description

widgets is a collection of types that implement Widget or StatefulWidget or both.

The widgets provided with Ratatui are implemented in the ratatui_widgets crate, and are re-exported here. The Widget and StatefulWidget traits are implemented in the ratatui_core crate and are also re-exported in this module. This means that you can use these types directly from the ratatui crate without having to import the ratatui_widgets crate.

Widgets are created for each frame as they are consumed after rendered. They are not meant to be stored but used as commands to draw common figures in the UI.

The available widgets are:

  • Block: a basic widget that draws a block with optional borders, titles and styles.
  • BarChart: displays multiple datasets as bars with optional grouping.
  • calendar::Monthly: displays a single month.
  • Canvas: draws arbitrary shapes using drawing characters.
  • Chart: displays multiple datasets as a lines or scatter graph.
  • Clear: clears the area it occupies. Useful to render over previously drawn widgets.
  • Gauge: displays progress percentage using block characters.
  • LineGauge: display progress as a line.
  • List: displays a list of items and allows selection.
  • Paragraph: displays a paragraph of optionally styled and wrapped text.
  • Scrollbar: displays a scrollbar.
  • Sparkline: display a single data set as a sparkline.
  • Table: displays multiple rows and columns in a grid and allows selection.
  • Tabs: displays a tab bar and allows selection.
  • RatatuiLogo: displays the Ratatui logo.
  • RatatuiMascot: displays the Ratatui mascot.

Modules§

  • Elements related to the Block base widget.
  • calendarwidget-calendar
    A simple calendar widget. (feature: widget-calendar)
  • A Canvas and a collection of Shapes.

Structs§

  • An X or Y axis for the Chart widget
  • A bar to be shown by the BarChart widget.
  • A chart showing values as bars.
  • A group of bars to be shown by the Barchart.
  • Base widget to be used to display a box border around all other built-in widgets.
  • Bitflags that can be composed to set the visible borders essentially on the block widget.
  • A Cell contains the Text to be displayed in a Row of a Table.
  • A widget to plot one or more Dataset in a cartesian coordinate system
  • A widget to clear/reset a certain area to allow overdrawing (e.g. for popups).
  • A group of data points
  • A widget to display a progress bar.
  • A compact widget to display a progress bar over a single thin line.
  • A widget to display several items among which one can be selected (optional)
  • A single item in a List
  • State of the List widget
  • Defines the padding for a Block.
  • A widget to display some text.
  • A widget that renders the Ratatui logo
  • A widget that renders the Ratatui mascot
  • A single row of data to be displayed in a Table widget.
  • A widget to display a scrollbar
  • A struct representing the state of a Scrollbar widget.
  • Widget to render a sparkline over one or more lines.
  • An bar in a Sparkline.
  • A widget to display data in formatted columns.
  • State of a Table widget
  • A widget that displays a horizontal set of Tabs with a single tab selected.
  • Describes how to wrap text across lines.

Enums§

Traits§