Skip to main content

Elements

Newt ships with 73 built-in elements organized into six categories. Every element can accept props and, where it makes sense, children.

Sections

Structural containers that define the high-level regions of a page.

ElementPurpose
headerTop-of-page banner, typically for branding and navigation
footerBottom-of-page area for links and legal text
containerWidth-constrained wrapper with padding
sidebarSide panel for navigation or filters
sectionGeneric content section
screen SectionsDemo {
column()(
header(fill: #1f2937, padding: 16)(
text("My App", fontSize: 20, fontWeight: "700")
)
container(padding: 32)(
section()(
text("Main content goes here", fontSize: 16)
)
)
footer(fill: #f3f4f6, padding: 16)(
text("Copyright 2026", fontSize: 12)
)
)
}

Layout

Primitives for arranging elements on screen.

ElementPurpose
rowHorizontal flex container
columnVertical flex container
stackOverlapping layers (z-axis stacking)
centerCenters its children both horizontally and vertically
boxGeneric container with styling
widgetSelf-contained interactive block
cardStyled container with stroke, radius, and padding
gridCSS-grid-style layout with columns and rows
screen LayoutDemo {
column(gap: 16, padding: 24)(
row(gap: 12)(
box(fill: #e0e0e0, radius: 4)(text("Left"))
box(fill: #e0e0e0, radius: 4)(text("Right"))
)
grid(columns: "1fr 1fr 1fr", gap: 8)(
card(fill: #ffffff, stroke: #e5e7eb, radius: 8, padding: 12)(text("A"))
card(fill: #ffffff, stroke: #e5e7eb, radius: 8, padding: 12)(text("B"))
card(fill: #ffffff, stroke: #e5e7eb, radius: 8, padding: 12)(text("C"))
)
)
}

Elements for moving between views, sections, or pages.

ElementPurpose
accordionExpandable/collapsible content sections
bentoGrid-based navigation layout
breadcrumbHierarchical path indicator
hamburgerThree-line menu toggle icon
kebabVertical three-dot menu icon
meatballsHorizontal three-dot menu icon
donerStacked horizontal lines menu icon
tabsTabbed content switcher
paginationPage number navigation
linkListVertical list of navigable links
navNavigation bar container
screen NavigationDemo {
column(gap: 16, padding: 24)(
nav(fill: #ffffff, stroke: #e5e7eb, padding: 12)(
row(gap: 16)(
text("Home", fontWeight: "600")
text("About")
text("Contact")
spacer()
hamburger()
)
)
breadcrumb()(
text("Home")
text("Products")
text("Details")
)
tabs()(
text("Overview")
text("Specs")
text("Reviews")
)
)
}

Input

Interactive elements that accept user input.

ElementPurpose
buttonClickable action trigger
inputSingle-line text field
passwordMasked text field for passwords
searchText field with search semantics
checkboxBoolean toggle with a checkmark
radioSingle selection from a group
dropdownSelect from a list of options
comboboxSearchable dropdown
multiselectSelect multiple options from a list
datePickerCalendar-based date selection
pickerGeneric value picker
sliderRange input with a draggable handle
stepperIncrement/decrement numeric input
toggleOn/off switch
formGroups inputs and handles submission
screen InputDemo {
column(gap: 16, padding: 24)(
input(placeholder: "Enter your name", stroke: #d1d5db, radius: 8, padding: 12)
password(placeholder: "Password", stroke: #d1d5db, radius: 8, padding: 12)
row(gap: 12)(
checkbox()
text("I agree to the terms")
)
row(gap: 12)(
button("Submit", fill: #2563eb, radius: 8)
button("Cancel", stroke: #d1d5db, radius: 8)
)
)
}

Feedback

Elements that communicate status, confirmations, or progress to the user.

ElementPurpose
modalOverlay dialog that blocks interaction
confirmDialogModal with confirm/cancel actions
toastBrief notification that auto-dismisses
notificationPersistent notification with actions
alertInline status message (info, warning, error)
messageBoxBordered message container
tooltipHover-triggered information popup
loaderSpinning or pulsing loading indicator
progressBarHorizontal bar showing completion
badgeSmall label for counts or status
screen FeedbackDemo {
column(gap: 16, padding: 24)(
alert(fill: #fef3c7, stroke: #f59e0b, radius: 8, padding: 12)(
text("Warning: this action cannot be undone.", fontSize: 14)
)
row(gap: 12)(
badge { content: "New", fill: #dbeafe }
badge { content: "3", fill: #fee2e2 }
badge { content: "Active", fill: #dcfce7 }
)
progressBar(fill: #2563eb, radius: 4)
loader()
)
}

Display

Elements for presenting content that is not interactive.

ElementPurpose
textRender a string of text
iconDisplay a named icon
tagLabeled chip for categories or filters
commentStyled comment block with author context
feedScrollable list of content items
carouselHorizontally swipeable content viewer
chartData visualization (bar, line, pie)
imageDisplay an image from a URL or path
spacerFlexible empty space that pushes siblings apart
screen DisplayDemo {
column(gap: 16, padding: 24)(
text("Display Elements", fontSize: 24, fontWeight: "700")
row(gap: 8)(
tag { content: "Rust", fill: #fef3c7 }
tag { content: "UI", fill: #dbeafe }
tag { content: "Language", fill: #dcfce7 }
)
image(src: "https://example.com/hero.png", radius: 8)
spacer()
text("End of page", fontSize: 12)
)
}

Data & Advanced Input

Elements for structured data display and rich user input.

ElementPurpose
tableStructured data display with rows and columns
avatarCircular user photo or initials fallback
textareaMulti-line text input
selectSingle-value picker dropdown
ratingInteractive star rating input (1-5 scale)
fileUploadDrag-and-drop file upload zone
colorPickerVisual color selection with hex input
screen DataDemo {
column(gap: 16, padding: 24)(
table(stroke: #e5e7eb, radius: 8, padding: 16)(
text("Name")
text("Role")
text("Status")
)
row(gap: 12)(
avatar(fill: #7c3aed, radius: 999)
avatar(fill: #2563eb, radius: 999)
avatar(fill: #10b981, radius: 999)
)
textarea(stroke: #d1d5db, radius: 8, padding: 12, placeholder: "Write a message...")
rating(fill: #f59e0b)
)
}

Overlay & Layout

Elements for slide-out panels, floating content, and advanced layout.

ElementPurpose
drawerSlide-out panel from any screen edge
popoverFloating content panel anchored to a trigger
separatorHorizontal or vertical divider line
splitterResizable split pane divider
skeletonAnimated placeholder shimmer while loading
timelineVertical sequence of events with timestamps
treeViewHierarchical expandable/collapsible node list
commandPaletteSearchable command menu (Cmd+K pattern)
screen OverlayDemo {
column(gap: 16, padding: 24)(
splitter()(
box(fill: #f9fafb, padding: 16)(
treeView()(
text("src/")
text(" main.rs")
text(" lib.rs")
)
)
box(fill: #ffffff, padding: 16)(
text("Editor panel", fontSize: 16)
)
)
separator()
timeline()(
text("Project created")
text("First commit")
text("v0.1 released")
)
skeleton(fill: #e5e7eb, radius: 8, height: 48)
)
}

Next steps

  • Props — every prop with its type, default, and description.
  • Components — define reusable UI blocks from elements.
  • Examples — full working programs that use elements in context.