Tabs
Two to five tabs inside one screen, drawn as a segmented control. Only the tab on screen loads its data.
Use it for: One page with several sides, such as a project’s overview, logs and money. Each child is a Tab. The chosen tab is kept when the person comes back to the screen.
- CategoryLayout
- ChildrenAny number
- DataNone
- ActionNone
| Prop | Required | Accepts | What it does |
|---|---|---|---|
style |
Yes | text | How the tabs are drawn. segmented is the only style. |
Every component also accepts id (required, unique on its screen), and the optional preset and style described in Style options. Every component except Screen accepts when, described in Data-driven look.
Example
Section titled “Example”From the Northline Builders example project:
{ "id": "project-tabs", "type": "Tabs", "props": { "style": "segmented" }, "children": [ { "id": "tab-overview", "type": "Tab", "props": { "label": "Overview" }, "preset": "group", "children": [ { "id": "project-overview", "type": "Record", "props": { "emptyText": "This project is no longer available." }, "children": [ { "id": "overview-cards", "type": "Stack", "props": {}, "children": [ { "id": "where", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "where-icon", "type": "Icon", "props": { "name": "location", "label": "Address", "size": "sm" }, "style": { "color": "$color.muted" } }, { "id": "where-words", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "address", "type": "Text", "props": {}, "preset": "body", "bindings": { "value": { "model": "overview", "field": "address" } } }, { "id": "city", "type": "Text", "props": {}, "preset": "note", "bindings": { "value": { "model": "overview", "field": "city" } } } ] }, { "id": "copy-address", "type": "Button", "props": { "label": "Copy", "variant": "plain" }, "action": { "type": "contact", "method": "copy", "value": { "source": "field", "model": "overview", "field": "address" } } } ] }, { "id": "site-map", "type": "Map", "props": { "address": "site-address", "latitude": "latitude", "longitude": "longitude", "directions": true, "height": "sm" }, "when": { "model": "overview", "field": "site-address", "is": { "source": "test", "test": "not-empty" } } }, { "id": "late", "type": "Card", "props": {}, "preset": "alert", "children": [ { "id": "late-line", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "late-icon", "type": "Icon", "props": { "name": "warning", "label": "Overdue" }, "style": { "color": "$color.primary" } }, { "id": "late-words", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "late-title", "type": "Text", "props": { "text": "Project overdue" }, "preset": "label" }, { "id": "late-days", "type": "Row", "props": {}, "children": [ { "id": "late-count", "type": "Text", "props": { "format": { "style": "number", "decimals": 0 } }, "preset": "note", "bindings": { "value": { "model": "overview", "field": "days-overdue" } } }, { "id": "late-unit", "type": "Text", "props": { "text": "days past the due date" }, "preset": "note" } ], "style": { "gap": "$spacing.xs" } } ] } ] } ], "when": { "model": "overview", "field": "days-overdue", "is": { "source": "literal", "value": 0, "compare": "gt" } } }, { "id": "budget", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "budget-eyebrow", "type": "Text", "props": { "text": "Budget" }, "preset": "eyebrow" }, { "id": "budget-line", "type": "Row", "props": {}, "children": [ { "id": "budget-ring", "type": "ProgressRing", "props": { "label": "Budget used", "size": "md", "caption": "used" }, "bindings": { "value": { "model": "overview", "field": "percent-used" } } }, { "id": "budget-figures", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "spent-label", "type": "Text", "props": { "text": "Spent" }, "preset": "note" }, { "id": "spent", "type": "Text", "props": { "format": { "style": "currency", "currency": "USD", "decimals": 0 } }, "preset": "figure", "bindings": { "value": { "model": "overview", "field": "spent" } } }, { "id": "budget-label", "type": "Text", "props": { "text": "Budget" }, "preset": "note" }, { "id": "budget-total", "type": "Text", "props": { "format": { "style": "currency", "currency": "USD", "decimals": 0 } }, "preset": "label", "bindings": { "value": { "model": "overview", "field": "budget" } } } ] } ], "style": { "gap": "$spacing.lg", "align": "center" } } ] }, { "id": "schedule", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "schedule-eyebrow", "type": "Text", "props": { "text": "Schedule" }, "preset": "eyebrow" }, { "id": "schedule-top", "type": "Row", "props": {}, "preset": "between", "children": [ { "id": "schedule-label", "type": "Text", "props": { "text": "Progress" }, "preset": "note" }, { "id": "schedule-percent", "type": "Text", "props": { "format": { "style": "percent" } }, "preset": "label", "bindings": { "value": { "model": "overview", "field": "progress" } } } ] }, { "id": "schedule-bar", "type": "ProgressBar", "props": { "label": "Schedule progress" }, "bindings": { "value": { "model": "overview", "field": "progress" } } }, { "id": "dates", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "start", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "start-label", "type": "Text", "props": { "text": "Start" }, "preset": "note" }, { "id": "start-date", "type": "Text", "props": { "format": { "style": "date" } }, "preset": "label", "bindings": { "value": { "model": "overview", "field": "start-date" } } } ] }, { "id": "due", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "due-label", "type": "Text", "props": { "text": "Due" }, "preset": "note" }, { "id": "due-date", "type": "Text", "props": { "format": { "style": "date" } }, "preset": "label", "bindings": { "value": { "model": "overview", "field": "due-date" } } } ] } ] } ] }, { "id": "overview-actions", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "open-team", "type": "Button", "props": { "label": "Team", "icon": "people", "variant": "tinted" }, "action": { "type": "navigate", "routeId": "team", "parameters": { "project-id": { "source": "field", "model": "overview", "field": "id" } } } }, { "id": "open-edit", "type": "Button", "props": { "label": "Edit project", "icon": "edit", "variant": "outline" }, "action": { "type": "navigate", "routeId": "edit-project", "parameters": { "id": { "source": "field", "model": "overview", "field": "id" } } } } ] }, { "id": "delete-project", "type": "Button", "props": { "label": "Delete project", "variant": "plain", "icon": "trash" }, "style": { "color": "$color.error" }, "action": { "type": "operation", "operationId": "delete-project", "parameters": { "id": { "source": "field", "model": "overview", "field": "id" } }, "confirm": { "title": "Delete this project?", "message": "Only a project with no logs, contacts, documents or expenses can be deleted. This can’t be undone.", "label": "Delete project", "destructive": true }, "after": "back" } } ], "style": { "gap": "$spacing.md" } } ], "bindings": { "record": { "operationId": "get-overview", "parameters": { "id": { "source": "route", "parameter": "id" } } } } }, { "id": "key-contacts-block", "type": "Stack", "props": {}, "preset": "group", "children": [ { "id": "key-contacts-title", "type": "Text", "props": { "text": "Key contacts" }, "preset": "title" }, { "id": "key-contacts", "type": "RecordList", "props": { "pageSize": 2, "emptyText": "No contacts yet. Add the people on this job under Team.", "separator": "none" }, "children": [ { "id": "key", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "key-top", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "key-icon", "type": "Icon", "props": { "name": "person", "label": "Contact", "size": "sm", "tile": "circle" }, "style": { "backgroundColor": "$color.raised", "color": "$color.primary" } }, { "id": "key-who", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "key-name", "type": "Text", "props": {}, "preset": "label", "bindings": { "value": { "model": "contact-card", "field": "name" } } }, { "id": "key-role", "type": "Text", "props": {}, "preset": "note", "bindings": { "value": { "model": "contact-card", "field": "role" } } }, { "id": "key-company", "type": "Text", "props": {}, "preset": "note", "bindings": { "value": { "model": "contact-card", "field": "company" } } } ] }, { "id": "key-edit", "type": "Button", "props": { "label": "Edit", "icon": "edit", "variant": "plain" }, "action": { "type": "navigate", "routeId": "edit-contact", "parameters": { "id": { "source": "field", "model": "contact-card", "field": "id" } } } } ] }, { "id": "key-phone-block", "type": "Stack", "props": {}, "preset": "tight", "children": [ { "id": "key-phone", "type": "Text", "props": {}, "preset": "body", "bindings": { "value": { "model": "contact-card", "field": "phone" } } }, { "id": "key-phone-actions", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "key-call", "type": "Button", "props": { "label": "Call", "icon": "phone", "variant": "tinted" }, "action": { "type": "contact", "method": "call", "value": { "source": "field", "model": "contact-card", "field": "phone" } } }, { "id": "key-text", "type": "Button", "props": { "label": "Text", "icon": "message", "variant": "tinted" }, "action": { "type": "contact", "method": "text", "value": { "source": "field", "model": "contact-card", "field": "phone" } } }, { "id": "key-copy", "type": "Button", "props": { "label": "Copy", "variant": "plain" }, "action": { "type": "contact", "method": "copy", "value": { "source": "field", "model": "contact-card", "field": "phone" } } } ] } ], "when": { "model": "contact-card", "field": "phone", "is": { "source": "test", "test": "not-empty" } } }, { "id": "key-email-block", "type": "Stack", "props": {}, "preset": "tight", "children": [ { "id": "key-email", "type": "Text", "props": {}, "preset": "body", "bindings": { "value": { "model": "contact-card", "field": "email" } } }, { "id": "key-email-actions", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "key-mail", "type": "Button", "props": { "label": "Email", "icon": "mail", "variant": "tinted" }, "action": { "type": "contact", "method": "email", "value": { "source": "field", "model": "contact-card", "field": "email" } } }, { "id": "key-copy-email", "type": "Button", "props": { "label": "Copy", "variant": "plain" }, "action": { "type": "contact", "method": "copy", "value": { "source": "field", "model": "contact-card", "field": "email" } } } ] } ], "when": { "model": "contact-card", "field": "email", "is": { "source": "test", "test": "not-empty" } } } ] } ], "bindings": { "items": { "operationId": "list-key-contacts", "parameters": { "project-id": { "source": "route", "parameter": "id" } }, "pagination": { "offset": 0, "limit": 2 } } } } ] } ] }, { "id": "tab-logs", "type": "Tab", "props": { "label": "Logs" }, "preset": "group", "children": [ { "id": "add-log", "type": "Button", "props": { "label": "New log", "icon": "plus", "size": "lg" }, "action": { "type": "navigate", "routeId": "new-log", "parameters": { "project-id": { "source": "route", "parameter": "id" } } } }, { "id": "log-list", "type": "RecordList", "props": { "pageSize": 20, "emptyText": "No logs yet. Add one at the end of each day on site.", "separator": "none" }, "children": [ { "id": "log", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "log-top", "type": "Row", "props": {}, "preset": "between", "children": [ { "id": "log-tags", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "category-daily", "type": "Badge", "props": { "text": "Daily log" }, "when": { "model": "log-card", "field": "category", "is": { "source": "literal", "value": "daily" } }, "style": { "color": "$color.secondary", "backgroundColor": "$color.sky-soft" } }, { "id": "category-safety", "type": "Badge", "props": { "text": "Safety" }, "when": { "model": "log-card", "field": "category", "is": { "source": "literal", "value": "safety" } }, "style": { "color": "$color.success", "backgroundColor": "$color.success-soft" } }, { "id": "category-incident", "type": "Badge", "props": { "text": "Incident" }, "when": { "model": "log-card", "field": "category", "is": { "source": "literal", "value": "incident" } }, "style": { "color": "$color.error", "backgroundColor": "$color.error-soft" } }, { "id": "category-material", "type": "Badge", "props": { "text": "Material" }, "when": { "model": "log-card", "field": "category", "is": { "source": "literal", "value": "material" } }, "style": { "color": "$color.primary", "backgroundColor": "$color.amber-soft" } }, { "id": "category-equipment", "type": "Badge", "props": { "text": "Equipment" }, "when": { "model": "log-card", "field": "category", "is": { "source": "literal", "value": "equipment" } }, "style": { "color": "$color.soft", "backgroundColor": "$color.raised" } } ] }, { "id": "log-when", "type": "Text", "props": { "format": { "style": "datetime" } }, "preset": "note", "bindings": { "value": { "model": "log-card", "field": "created-at" } } } ] }, { "id": "log-notes", "type": "Text", "props": { "maxLines": 3 }, "preset": "body", "bindings": { "value": { "model": "log-card", "field": "notes" } } }, { "id": "log-photos", "type": "Gallery", "props": { "columns": 4, "maxShown": 4 }, "bindings": { "value": { "model": "log-card", "field": "photos" } }, "when": { "model": "log-card", "field": "photos", "is": { "source": "test", "test": "not-empty" } } }, { "id": "log-foot", "type": "Row", "props": {}, "preset": "between", "children": [ { "id": "log-by", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "log-author-icon", "type": "Icon", "props": { "name": "person", "label": "Author", "size": "sm" }, "style": { "color": "$color.muted" } }, { "id": "log-author", "type": "Text", "props": {}, "preset": "note", "bindings": { "value": { "model": "log-card", "field": "author" } } }, { "id": "log-date", "type": "Text", "props": { "format": { "style": "date" } }, "preset": "note", "bindings": { "value": { "model": "log-card", "field": "log-date" } } } ] }, { "id": "log-open", "type": "Icon", "props": { "name": "chevron-right", "label": "Open log", "size": "sm" }, "style": { "color": "$color.muted" } } ] } ], "action": { "type": "navigate", "routeId": "log", "parameters": { "id": { "source": "field", "model": "log-card", "field": "id" } } } } ], "bindings": { "items": { "operationId": "list-logs", "parameters": { "project-id": { "source": "route", "parameter": "id" } }, "pagination": { "offset": 0, "limit": 20 } } } } ] }, { "id": "tab-money", "type": "Tab", "props": { "label": "Financials" }, "preset": "group", "children": [ { "id": "money-summary", "type": "Record", "props": { "emptyText": "This project could not be found." }, "children": [ { "id": "money-budget", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "money-eyebrow", "type": "Text", "props": { "text": "Budget" }, "preset": "eyebrow" }, { "id": "money-line", "type": "Row", "props": {}, "children": [ { "id": "money-ring", "type": "ProgressRing", "props": { "label": "Budget used", "size": "md", "caption": "used" }, "bindings": { "value": { "model": "overview", "field": "percent-used" } } }, { "id": "money-figures", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "money-spent-label", "type": "Text", "props": { "text": "Spent" }, "preset": "note" }, { "id": "money-spent", "type": "Text", "props": { "format": { "style": "currency", "currency": "USD", "decimals": 0 } }, "preset": "figure", "bindings": { "value": { "model": "overview", "field": "spent" } } }, { "id": "money-budget-label", "type": "Text", "props": { "text": "Budget" }, "preset": "note" }, { "id": "money-budget-total", "type": "Text", "props": { "format": { "style": "currency", "currency": "USD", "decimals": 0 } }, "preset": "label", "bindings": { "value": { "model": "overview", "field": "budget" } } } ] } ], "style": { "gap": "$spacing.lg", "align": "center" } } ] } ], "bindings": { "record": { "operationId": "get-overview", "parameters": { "id": { "source": "route", "parameter": "id" } } } } }, { "id": "by-category", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "by-category-title", "type": "Text", "props": { "text": "Where the money went" }, "preset": "eyebrow" }, { "id": "category-chart", "type": "Chart", "props": { "kind": "donut", "y": "total", "format": { "style": "currency", "currency": "USD", "decimals": 0 }, "title": "Spending by category", "emptyText": "No expenses yet.", "x": "category" }, "bindings": { "items": { "operationId": "list-spend-by-category", "parameters": { "project-id": { "source": "route", "parameter": "id" } }, "pagination": { "offset": 0, "limit": 20 } } } } ] }, { "id": "by-month", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "by-month-title", "type": "Text", "props": { "text": "Spending by month" }, "preset": "eyebrow" }, { "id": "month-chart", "type": "Chart", "props": { "kind": "stacked-bar", "y": "total", "format": { "style": "currency", "currency": "USD", "decimals": 0 }, "title": "Spending by month and category", "emptyText": "No expenses yet.", "x": "month", "series": "category" }, "bindings": { "items": { "operationId": "list-spend-by-month", "parameters": { "project-id": { "source": "route", "parameter": "id" } }, "pagination": { "offset": 0, "limit": 100 } } } } ] }, { "id": "expenses-head", "type": "Row", "props": {}, "preset": "between", "children": [ { "id": "expenses-title", "type": "Text", "props": { "text": "Expenses" }, "preset": "title" }, { "id": "add-expense", "type": "Button", "props": { "label": "Add expense", "icon": "plus", "variant": "tinted" }, "action": { "type": "navigate", "routeId": "new-expense", "parameters": { "project-id": { "source": "route", "parameter": "id" } } } } ] }, { "id": "expense-list", "type": "RecordList", "props": { "pageSize": 25, "emptyText": "No expenses yet. Add the first receipt.", "separator": "none" }, "children": [ { "id": "expense", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "expense-top", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "expense-words", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "expense-vendor", "type": "Text", "props": {}, "preset": "label", "bindings": { "value": { "model": "expense", "field": "vendor" } } }, { "id": "expense-meta", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "kind-materials", "type": "Badge", "props": { "text": "Materials" }, "when": { "model": "expense", "field": "category", "is": { "source": "literal", "value": "materials" } }, "style": { "color": "$color.primary", "backgroundColor": "$color.amber-soft" } }, { "id": "kind-labor", "type": "Badge", "props": { "text": "Labor" }, "when": { "model": "expense", "field": "category", "is": { "source": "literal", "value": "labor" } }, "style": { "color": "$color.secondary", "backgroundColor": "$color.sky-soft" } }, { "id": "kind-equipment", "type": "Badge", "props": { "text": "Equipment" }, "when": { "model": "expense", "field": "category", "is": { "source": "literal", "value": "equipment" } }, "style": { "color": "$color.soft", "backgroundColor": "$color.raised" } }, { "id": "kind-fuel", "type": "Badge", "props": { "text": "Fuel" }, "when": { "model": "expense", "field": "category", "is": { "source": "literal", "value": "fuel" } }, "style": { "color": "$color.error", "backgroundColor": "$color.error-soft" } }, { "id": "kind-permits", "type": "Badge", "props": { "text": "Permits" }, "when": { "model": "expense", "field": "category", "is": { "source": "literal", "value": "permits" } }, "style": { "color": "$color.success", "backgroundColor": "$color.success-soft" } }, { "id": "kind-other", "type": "Badge", "props": { "text": "Other" }, "when": { "model": "expense", "field": "category", "is": { "source": "literal", "value": "other" } }, "style": { "color": "$color.soft", "backgroundColor": "$color.raised" } }, { "id": "expense-date", "type": "Text", "props": { "format": { "style": "date" } }, "preset": "note", "bindings": { "value": { "model": "expense", "field": "spent-on" } } } ] } ] }, { "id": "expense-amount", "type": "Text", "props": { "format": { "style": "currency", "currency": "USD", "decimals": 0 } }, "preset": "figure", "bindings": { "value": { "model": "expense", "field": "amount" } } } ] }, { "id": "expense-foot", "type": "Row", "props": {}, "preset": "between", "children": [ { "id": "expense-paid-by", "type": "Text", "props": {}, "preset": "note", "bindings": { "value": { "model": "expense", "field": "paid-by" } } }, { "id": "expense-edit", "type": "Button", "props": { "label": "Edit", "icon": "edit", "variant": "plain" }, "action": { "type": "navigate", "routeId": "edit-expense", "parameters": { "id": { "source": "field", "model": "expense", "field": "id" } } } } ] } ] } ], "bindings": { "items": { "operationId": "list-expenses", "parameters": { "project-id": { "source": "route", "parameter": "id" } }, "pagination": { "offset": 0, "limit": 25 } } } } ] }, { "id": "tab-docs", "type": "Tab", "props": { "label": "Docs" }, "preset": "group", "children": [ { "id": "add-document", "type": "Button", "props": { "label": "Add document", "icon": "upload", "size": "lg" }, "action": { "type": "navigate", "routeId": "new-document", "parameters": { "project-id": { "source": "route", "parameter": "id" } } } }, { "id": "document-list", "type": "RecordList", "props": { "pageSize": 25, "emptyText": "No documents yet. Add plans, estimates, permits or photos.", "separator": "none" }, "children": [ { "id": "document", "type": "Card", "props": {}, "preset": "panel", "children": [ { "id": "document-top", "type": "Row", "props": {}, "preset": "line", "children": [ { "id": "document-words", "type": "Stack", "props": {}, "preset": "grow", "children": [ { "id": "document-title", "type": "Text", "props": { "maxLines": 2 }, "preset": "label", "bindings": { "value": { "model": "document", "field": "title" } } }, { "id": "document-added", "type": "Text", "props": { "format": { "style": "datetime" } }, "preset": "note", "bindings": { "value": { "model": "document", "field": "added-at" } } } ] }, { "id": "document-edit", "type": "Button", "props": { "label": "Edit", "icon": "edit", "variant": "plain" }, "action": { "type": "navigate", "routeId": "edit-document", "parameters": { "id": { "source": "field", "model": "document", "field": "id" } } } } ] }, { "id": "document-file", "type": "File", "props": { "label": "Document", "fit": "contain" }, "bindings": { "value": { "model": "document", "field": "file" } } } ] } ], "bindings": { "items": { "operationId": "list-documents", "parameters": { "project-id": { "source": "route", "parameter": "id" } }, "pagination": { "offset": 0, "limit": 25 } } } } ] } ]}