Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 1.04 KB

std.md

File metadata and controls

48 lines (35 loc) · 1.04 KB

Std

These are standard html elements but please prefer the more flexible chakra component if it exists.

Example

Dependency: io.github.kostaskougios::terminal21-ui-std:$VERSION

Paragraph, NewLine, Span, Em

Paragraph(text = "Hello World!").withChildren(
    NewLine(),
    Span(text = "Some more text"),
    Em(text = " emphasized!"),
    NewLine(),
    Span(text = "And the last line")
)

Header

Header1(text = "Welcome to the std components demo/test")

Input

    val input  = Input(defaultValue = "Please enter your name")
    val output = Paragraph(text = "This will reflect what you type in the input")
    input.onChange: newValue =>
      output.withText(newValue).renderChanges()

Cookies

Set a cookie:

Cookie(name = "cookie-name", value = "cookie value")

Read a cookie:

val cookieReader = CookieReader(key = "cookie-reader", name = "cookie-name")
val cookieValue   = events.changedValue(cookieReader)