Built-in elements
Every element you can write in a template, grouped by purpose. All of them ship with janelkit.
janelkit Included with janelkit. Nothing extra to install. What you will learn
- Which elements exist and what each family is for.
- Why built-in tags are lowercase and imported ones start with a capital letter.
- The properties every element accepts.
- How text between tags becomes a caption.
Everything here is already installed
Every element on this page is part of the core janelkit package. You do not install anything else and you do not import elements in the script: write <button> in the template and it works. The packages of the ecosystem add services, and a few components of their own such as <Pages> in janelkit-router, but every control is here.
Tags are case-sensitive. As in HTML, lowercase tags are what the platform gives you: the built-in elements, such as <text>, <button> and <flex>. A tag that starts with a capital letter is a component your script imports, from your project or from a package: <TodoItem>, <Pages>. So a component of yours may be called Button without clashing with <button>. An unknown tag, property or event is a compile error that lists the valid options and suggests the closest name.
Learn moreThe JanelKit ecosystem ↗
Elements grouped by what they are for
Choose an element by the job it does. The next chapters use these elements, and Forms explains every input control in detail.
| Family | Elements | Use them to |
|---|---|---|
| Window | <window> | Open the application window, with its title, size and screen. |
| Layout | <column>, <row>, flex, <spacer>, <scroll> | Arrange other elements vertically, horizontally, with free space, or in a scrolling area. |
| Text and media | <text>, <image>, <video> | Show text (plain, Markdown or HTML), pictures, or live video frames. |
| Actions | <button>, <shortcut> | Run something on a click or on a key combination. |
| Input | <textfield>, <textarea>, <checkbox>, <switch>, <slider>, <select>, <radiogroup>, <tabs> | Let the user type text, toggle a value, pick a number or choose an option. |
| Feedback | <progressbar> | Show progress, or that work is ongoing. |
| Collections | <list> | Show hundreds or thousands of rows efficiently. |
A tour in one window
This component uses one element from most families. Run it, then change one thing at a time to see what each element does.
<script lang="python">
from janelkit import state
progress = state(0.3)
dark = state(False)
</script>
<window title="Element tour" width={460} height={320}>
<column padding={24} gap={12}>
<text format="markdown">**Built-in elements** need no imports.</text>
<progressbar value={progress} />
<row gap={8}>
<button on:click={progress = min(progress + 0.1, 1)}>More progress</button>
<spacer />
<switch bind:checked={dark}>Dark mode</switch>
</row>
<text>Progress: {progress:.0%} · dark mode {"on" if dark else "off"}</text>
</column>
</window>CopyComplete component · Save as src/App.janel in a scaffolded project.
How it works
- <text> with format="markdown" renders the two asterisks as bold text.
- <progressbar> goes from 0 to its max, which defaults to 1, so 0.3 shows a bar 30 % full.
- <spacer> takes the free space in the <row> and pushes the <switch> to the right edge.
- The <switch> writes True or False into dark; the last line reads both states.
What you should see
The bar starts 30 % full and the last line says Progress: 30% · dark mode off. More progress fills the bar in steps until 100%. The <switch> changes the last line to dark mode on (it does not change the theme; that is shown in Styles).
Properties every element accepts
Besides its own properties, every element except <window> accepts the ones below. id, class and style are written the same way on any element.
| Property | What it does |
|---|---|
| width, height | Preferred size in pixels, or a percentage of the container. |
| flex | Share of the free space along the container’s direction. Explained in Layout. |
| visible | False hides the element and frees its space. The element still exists. |
| enabled | False disables a control: it ignores input and looks inactive. |
| opacity | Transparency from 0 (invisible) to 1 (opaque). |
| label | The name a screen reader announces. Needed when there is no visible text. |
| id | A stable name, used to find the element in tests. |
| class, style | Connect the element to style rules, or style it directly. Explained in Styles. |
Text between tags is the caption
For <text>, <button> and <checkbox>, the text between the tags is what they show: <button>Save</button>. It can include expressions: <button>Clicks: {count}</button>. Spaces and line breaks are collapsed into single spaces, so you can wrap long text over several lines. Loose text directly inside a container becomes a <text>.
<text> shows plain text by default. format="markdown" renders bold, italics, links, code and lists, and shows any HTML inside the text as written, so text written by other people can be shown directly; format="html" renders Qt’s subset of HTML. Clicking a link emits on:link with its URL; if nobody listens, it opens in the browser. <text> cannot be selected by default, like a label in a desktop application; add selectable to let the user select and copy it.
<text>Plain text</text>
<text format="markdown">Some **bold** and a [link](https://example.com)</text>
<text selectable>Order 4815-16 (the user can copy this)</text>CopyFragment · Add it to an existing component; it is not a complete file.
Common mistakes
- format="html" applies the HTML in the text. Never show text from other people with format="html"; use plain text or format="markdown", which does not interpret HTML.
Every element at a glance
The table lists each element with its own properties, its events and the values it can bind. Events written with a name in parentheses send that value to your handler, for example on:submit(text). Do not memorize it; come back when you need a detail.
| Element | Properties | Events | bind: |
|---|---|---|---|
| <window> | title, width, height, minWidth, minHeight, background, screen, fullscreen | on:activate, on:deactivate | — |
| <column>, <row> | gap, padding | on:click and pointer and keyboard events | — |
| flex | direction, wrap, gap, padding, align, justify, as, tabindex, disabled, title, checked, selected, expanded, style | on:click, pointer, wheel, keyboard, focus and resize events | — |
| <scroll> | gap, padding, follow | on:top, on:bottom, on:scroll(info) | — |
| <list> | gap, padding, animate, follow | on:top, on:bottom, on:scroll(info) | — |
| <text> | text, color, format (plain, markdown, html), selectable | on:link(url) | — |
| <button> | text, variant (default, primary, danger, ghost), flat | on:click | — |
| <textfield> | value, placeholder, readonly | on:input(text), on:submit(text), on:keydown, on:keyup, on:focus, on:blur | value |
| <textarea> | value, placeholder, readonly | on:input(text), on:keydown, on:keyup, on:focus, on:blur | value |
| <checkbox> | checked, text | on:change(checked) | checked |
| <switch> | checked, text | on:change(checked) | checked |
| <slider> | value, min (0), max (100), step | on:change(value) | value |
| <select> | options, value, placeholder | on:change(value), on:keydown, on:keyup, on:focus, on:blur | value |
| <radiogroup> | options, value, horizontal | on:change(value) | value |
| <tabs> | options, value | on:change(value) | value |
| <progressbar> | value, max (1), indeterminate | — | — |
| <image> | src, fit (contain, cover, fill, none), alt | — | — |
| <video> | source (a Frames object), fit (contain, cover, fill) | on:click, on:dblclick, on:contextmenu and pointer events, with image_x and image_y | — |
| <shortcut> | keys | on:activate | — |
| <spacer> | — | — | — |
Learn moreForms and two-way binding ↗Layout ↗Large lists ↗Video and frames ↗
Key points
- All elements are in the core: no install, no import.
- Built-in elements are lowercase; a tag with a capital letter is an imported component.
- Unknown tags and properties are compile errors with suggestions.
English documentation based on the JanelKit source. For additional details, browse the source docs ↗.