KScript docs
EN

Desktop apps

Layout

Column lays its contents out top to bottom, Row side by side, and Grid in equal columns. Column takes gap, align and scroll, Row takes gap, align and wrap, and Grid takes columns and gap. Box is a rectangle, such as a cell, a card or a panel, that can hold other elements and take on_click and border. Spacer(size) adds space:

<KScript.Window title="Board" padding="16">
  <Grid columns="3" gap="4">
    <for each="n" in="1..9">
      <Box border="gray" padding="12">
        <Text text_align="center">{$n}</Text>
      </Box>
    </for>
  </Grid>
  <Spacer size="12" />
  <Row gap="8">
    <Button variant="primary">Play</Button>
    <Button>Reset</Button>
  </Row>
</KScript.Window>
import KScript.UI

Window(title: 'Board', padding: 16) {
  Grid(columns: 3, gap: 4) {
    for n in 1..9 {
      Box(border: 'gray', padding: 12) {
        Text(text_align: center) "{$n}"
      }
    }
  }
  Spacer(size: 12)
  Row(gap: 8) {
    Button(variant: primary) "Play"
    Button "Reset"
  }
}

Text takes size, weight, color, wrap and text_align. Button takes on_click, variant: primary and disabled.

Styling

Every element except Spacer and Timer takes width, height, padding, margin, background, radius and tooltip. Colours are names such as "teal", or "#rrggbb".

Window takes title, width, height, theme (dark, light or system), background, padding, gap and resizable.

Components

A component with a window render is drawn by writing it as a statement, such as NoteCard(title: "Milk"). Each one keeps its own state.