Panel
A frame with a title on its border (a legend), around a body that holds its content.
import { Panel } from "x4js"
Title and icon
A frame with its title on its border, an icon before the title.
export function titled( ) {
return new HBox( { content: [
new Panel( { title: "Account", icon: icon_user, width: 260, content: [
new TextEdit( { label: "Name", value: "Ada" } ),
new TextEdit( { label: "Email", type: "email", value: "ada@example.com" } ),
] } ),
new Panel( { title: "Options", icon: icon_gear, width: 220, content: [
new Checkbox( { label: "Dark theme" } ),
new Checkbox( { label: "Notifications", checked: true } ),
] } ),
] } );
}
Inline
The class inline: a line above the content and its title, no frame.
export function inline( ) {
return new VBox( { width: 420, content: [
new Panel( { cls: "inline", title: "General", content: [
new Checkbox( { label: "Open the last file at start" } ),
] } ),
new Panel( { cls: "inline", title: "Advanced", content: [
new Checkbox( { label: "Log what happens" } ),
] } ),
] } );
}
setTitle
setTitle changes the text of the title, its icon stays; setContent fills its body.
export function setTitle( ) {
let count = 0;
const panel = new Panel( { title: "Messages", icon: icon_info, width: 300, content: "No message." } );
return new HBox( { content: [
panel,
new Button( { label: "New message", click: ( ) => {
count++;
panel.setTitle( `Messages (${count})` );
panel.setContent( `Message ${count} arrived.` );
} } ),
] } );
}
For an assistant: llms.txt, llms-full.txt.