TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sxyazi/yazi/llms.txt
Use this file to discover all available pages before exploring further.
ui namespace provides components and utilities for rendering UI elements in Yazi plugins.
Layout Utilities
ui.area(name)
Get the screen area for a component.
Area name:
"current", "preview", or "progress"Rectangle representing the area
ui.hide()
Hide the UI and yield to a subprocess (async).
Permit handle - UI will show again when dropped
ui.render()
Request a UI re-render.
ui.redraw(component)
Redraw a component.
Component table with
redraw() methodRenderable elements
Text Utilities
ui.truncate(str, options)
Truncate a string to fit a maximum width.
String to truncate
Truncation options
Maximum width in characters
Truncate from left (right-to-left) instead of right (default: false)
Truncated string with ellipsis (…) if needed
ui.width(value)
Calculate display width of a string or UI element.
String or UI element
Display width (accounting for wide characters)
ui.printable(str)
Convert non-printable characters to printable form.
String to convert
String with printable characters only
UI Components
All UI components support chaining methods and must have an area set.Common Methods
All components support these methods::area(rect)- Set component area
ui.Bar(value, symbol?)
Progress bar component.
Value between 0 and 100
Bar symbol (default: ”█“)
ui.Border
Border component.
Methods
:type(type)- Border type:ui.Border.PLAIN,ui.Border.ROUNDED:style(style)- Border style
ui.Clear
Clear a screen area.
ui.Constraint
Layout constraint.
ui.Gauge(ratio?)
Gauge/progress indicator.
Fill ratio between 0.0 and 1.0
Methods
:label(text)- Set label text:style(style)- Set gauge style
ui.Layout
Layout container for arranging components.
Methods
:direction(dir)-ui.Layout.HORIZONTALorui.Layout.VERTICAL:constraints(list)- List of constraints:split(area)- Split area and return chunks
ui.Line(text?)
Single line of text/spans.
Text string or table of Spans
Methods
:align(align)- Set alignment:ui.Align.LEFT,ui.Align.CENTER,ui.Align.RIGHT:style(style)- Set line style
ui.List(items?)
List of lines.
List of Line components
ui.Pad
Padding container.
Methods
:position(edge)- Edge position:ui.Edge.TOP,ui.Edge.BOTTOM, etc.
ui.Paragraph(text?)
Multi-line text paragraph.
List of Lines
Methods
:wrap(wrap)- Wrap mode:ui.Wrap.NO,ui.Wrap.YES,ui.Wrap.TRIM:align(align)- Text alignment
ui.Pos
Screen position.
ui.Rect
Rectangle area.
Methods
:padding(pad)- Apply padding and return inner rect
ui.Span(text?)
Styled text span.
Text content
Methods
:fg(color)- Foreground color:bg(color)- Background color:bold()- Bold text:dim()- Dim text:italic()- Italic text:underline()- Underline text:blink()- Blinking text:reverse()- Reverse colors:hidden()- Hidden text:crossed()- Strikethrough text:reset()- Reset all styles:style(style)- Apply style object
ui.Style
Style object for components.
ui.Span.
ui.Table
Table component.
Methods
:widths(constraints)- Column width constraints:col_spacing(n)- Spacing between columns
ui.Text(lines?)
Multi-line styled text.
Text string or list of Lines
Methods
:wrap(wrap)- Wrap mode:align(align)- Text alignment:style(style)- Text style
Enums
ui.Align
ui.Align.LEFTui.Align.CENTERui.Align.RIGHT
ui.Wrap
ui.Wrap.NO- No wrappingui.Wrap.YES- Wrap at word boundariesui.Wrap.TRIM- Trim whitespace
ui.Edge
ui.Edge.TOPui.Edge.RIGHTui.Edge.BOTTOMui.Edge.LEFT