Panels

Term.Panels.PanelType
Panel

Renderable with a panel surrounding some content:

    ╭──────────╮
    │ my panel │
    ╰──────────╯

When constructing a Panel, several keyword arguments can be used to set its appearance:

  • box::Symbol sets the Box type for the Panel's border
  • style::String sets the box's style (e.g., color)
  • title::Union{String,Nothing} sets the Panel's title
  • title_style::Union{Nothing,String} sets the title's style
  • title_justify::Symbol sets the location of the title
  • subtitle::Union{String,Nothing} sets the Panel's subtitle
  • subtitle_style::Union{Nothing,String} sets the subtitle's style
  • subtitle_justify::Symbol sets the location of the subtitle
  • justify::Symbol sets text's alignment (:left, :rigth, :center, :justify)
source
Term.Panels.PanelMethod

Panel(
    content::Union{AbstractString,AbstractRenderable},
    ::Val{false},
    padding::Padding;
    height::Union{Nothing,Int} = nothing,
    width::Int = 80,
    kwargs...,
)

Construct a Panel fitting content to it.

Tip

Content that is too large to fit in the given width will be trimmed. To avoid trimming, set fit=true when calling panel.

source
Term.Panels.PanelMethod

Panel(
    content::Union{AbstractString,AbstractRenderable},
    ::Val{true},
    padding::Padding;
    height::Union{Nothing,Int} = nothing,
    width::Union{Nothing,Int} = nothing,
    trim::Bool = true,
    kwargs...,
)

Construct a Panel fitting the content's width.

Warning

If the content is larger than the console terminal's width, it will get trimmed to avoid overflow, unless trim=false is given.

source
Term.Panels.PanelMethod

Panel(
    content::Union{AbstractString,AbstractRenderable};
    fit::Bool = true,
    padding::Union{Padding,NTuple} = Padding(2, 2, 0, 0),
    kwargs...,
)

Construct a Panel around an AbstractRenderable or AbstractString.

This is the main Panel-creating function, it dispatches to other methods based on the value of fit to either fith the Panel to its content or vice versa.

kwargs can be used to set various aspects of the Panel's appearance like the presence and style of titles, box type etc... see render below.

source
Term.Panels.PanelMethod
Panel(renderables; kwargs...)

Panel constructor for creating a panel out of multiple renderables at once.

source
Term.Panels.PanelMethod

Panel(; 
    fit::Bool = false,
    height::Int = 2,
    width::Int = 80,
    padding::Union{Vector,Padding,NTuple} = Padding(0, 0, 0, 0),
    kwargs...,  
)

Construct a Panel with no content.

Examples

julia> Panel(height=5, width=10)
╭────────╮
│        │
│        │
│        │
╰────────╯

julia> Panel(height=3, width=5)
╭───╮
│   │
╰───╯
source
Term.Panels.renderMethod
render(
    content;
    box::Symbol = :ROUNDED,
    style::String = "default",
    title::Union{String,Nothing} = nothing,
    title_style::Union{Nothing,String} = nothing,
    title_justify::Symbol = :left,
    subtitle::Union{String,Nothing} = nothing,
    subtitle_style::Union{Nothing,String} = nothing,
    subtitle_justify::Symbol = :left,
    justify::Symbol = :left,
    text_justify::Bool=false,
    panel_measure::Measure,
    content_measure::Measure,
    Δw::Int,
    Δh::Int,
    padding::Padding,
)::Panel

Construct a Panel's content.

source