Skip to main content

Vue DC UI KIT

Owner: Thilina Deepal

Introduction

The DC UI kit is the set of Vue 3 components and CSS classes that DoFramework screens are built from. The framework's own pages use it, and your app's pages should too, so that every app looks and behaves the same: the same buttons, fields, tables, popups and loaders, the same spacing and the same colours.

The kit has two parts:

  • 68 components, exported from one registry file, dc_ui_kit_registry.js. You import them into your page components like any ES module.
  • CSS classes with the dcui- prefix (and a few dc- ones): the components' own styles, plus utility classes for spacing, layout, sizes and text.

This page explains how the kit is loaded, how to import and use a component, the rules for building screens with it, the utility classes and the theming variables, and how the admin panel's copy differs. The components themselves are documented on one page per category. The component index below lists all 68 with a link to each.


How the kit is loaded

There is nothing to install. The framework loads the kit on every page, for every app. Don't add its files to xp-config.json or copy them into your app.

index.php builds two bundles of scripts and two of styles on each request (see App Frontend Config):

BundleBuilt fromWhat it brings for the kit
assets/lib-scripts.jsresources.scripts in xp-config.jsonVue 3.2.45 (the global build, which compiles template strings in the browser), Vue Router, Vuex 4 and jQuery. Then assets/libs/dc-ui-kit/0.0.2/dc-ui-kit.js, whose jQuery handlers open and close DcDropdown panels and switch basic tabs, and dc-script.js, which opens the side navigation's sub-menus.
assets/lib-styles.cssresources.styles in xp-config.jsonFont Awesome 6 Pro, then assets/libs/dc-ui-kit/0.0.2/dc-ui-kit.css (the Lato font, the core theming variables, the base styles of fields, buttons, checkboxes, tables and tabs, and the utility classes) and dc-style.css (the dc-* styles of the framework shell, such as the side navigation and dc-content-card).
assets/app-styles.cssresources.styles of every active app's app-config.jsonFrom xp_system: normalize.css, base_components.css (the styles of the newer components, such as the date pickers, DcSearchDropdown, DcSplitButton, DcPageHeader and the dashboard pieces), styles.css and tooltip.css.

The component files are not in any bundle. They are ES modules under apps/xp_system/components/dc_ui_kit_componenets/, and the browser fetches them when your component imports the registry. The import map that index.php prints versions their URLs, so keep imports bare, without ?v=.


How to use a component

Import from the registry​

Import components only from dc_ui_kit_registry.js, never from a component's own file. The registry is the kit's public list: some components live in subfolders (containers/, layouts/, panels/, DcDatepicker/), and three come from the framework's helpers.js, so the file paths are not something to rely on.

From a component in apps/myapp/components/, the path is:

import { DcCard, DcButton } from "../../xp_system/components/dc_ui_kit_componenets/dc_ui_kit_registry.js";

From a deeper folder, such as apps/myapp/components/orders/, add one ../ per extra level.

Register it and use its tag​

List each imported component in the components option, then write it in the template as a kebab-case tag: DcButton becomes dc-button, DcBoxIcon becomes dc-box-icon, DcAjaxLoader becomes dc-ajax-loader.

import { DcCard, DcBoxIcon, DcButton } from "../../xp_system/components/dc_ui_kit_componenets/dc_ui_kit_registry.js";

export default {
components: { DcCard, DcBoxIcon, DcButton },
data() {
return {
saving: false,
};
},
template: `
<dc-card>
<div class="dcui-flex-item dcui-align-center dcui-flex-gap-15 dcui-m-b-20">
<dc-box-icon icon="fa-regular fa-file-invoice"></dc-box-icon>
<h2 class="dcui-m-0">Invoices</h2>
</div>
<dc-button :disabled="saving" @click="save">Save</dc-button>
</dc-card>`,
methods: {
save() {
this.saving = true;
// call your service here
},
},
};

DcAjaxLoader, DcAjaxNotice and DcPagination are the framework helpers Ajax_Loader, Ajax_Notice and Pagination under kit names. Import the kit names from the registry: they work as ordinary kebab-case tags, which the underscore names don't.


How to follow the UI rules

The registry starts with the kit's rules for anyone building screens on the framework. In short:

  • Build screens from the kit. Use the exported components and the framework's dcui-* and dc-* classes. Don't write your own button, input, dropdown, table, tabs, popup, loader or empty state.
  • Import from the registry, never from a component's own file.
  • The registry is the full list. Check it, or the component index below, before deciding a component doesn't exist.
  • No inline styles and no new design values. Don't write style="...", and don't add colours, fonts, font sizes, shadows or CSS variables. Use the utility classes and the existing theming variables.
  • Confirm every delete in a DcPopup that names the item and says what will happen.
  • Don't invent a component. If nothing in the kit fits, build the screen from what is there, and ask the DoCloud team before writing a new component.

A delete confirmation that follows these rules:

import { DcButton, DcPopup } from "../../xp_system/components/dc_ui_kit_componenets/dc_ui_kit_registry.js";

export default {
components: { DcButton, DcPopup },
data() {
return {
customer: { id: 7, name: "Sam Perera" },
};
},
template: `
<dc-button @click="$refs.confirm_delete.show()">Delete customer</dc-button>

<dc-popup ref="confirm_delete" title="Delete customer?">
<template #content>
<p>{{ customer.name }} and their order history will be deleted. This can't be undone.</p>
<div class="dcui-flex-item dcui-justify-flex-end dcui-flex-gap-10">
<dc-button class="dcui-button-no-fill" @click="$refs.confirm_delete.hide()">Cancel</dc-button>
<dc-button @click="delete_customer">Delete</dc-button>
</div>
</template>
</dc-popup>`,
methods: {
async delete_customer() {
// call your service, then close the popup
this.$refs.confirm_delete.hide();
},
},
};

See Feedback And Overlays for everything DcPopup can do.


How to style with dcui classes

The utility classes are in dc-ui-kit.css (in assets/libs/dc-ui-kit/0.0.2/). base_components.css (in apps/xp_system/assets/) holds the styles of the components themselves, named after them (dcui-page-header, dcui-stat-group__value, dcui-calendar), so you don't normally write those by hand.

FamilyClassesExamples
Margindcui-m-, then a side and a size. Sides: none (all), t, b, l, r, tb, lr. Sizes: 0, 5, 10, 15, 20, 25, 30 (px).dcui-m-b-15, dcui-m-r-10, dcui-m-tb-5, dcui-m-0
Paddingdcui-p-, with the same sides and sizes. There is no dcui-p-lr-0.dcui-p-20, dcui-p-lr-15, dcui-p-t-0
Flex layoutdcui-flex-item (a flex row), dcui-flex-directions-column, dcui-flex-directions-row, dcui-flex-wrap, dcui-flex-nowrap, dcui-flex-wrap-reverse, dcui-flex-1, dcui-flex-grow, dcui-flex-shrinkdcui-flex-item dcui-flex-directions-column
Alignmentdcui-align-center, dcui-align-flex-start, dcui-align-flex-end, dcui-justify-center, dcui-justify-space-between, dcui-justify-space-around, dcui-justify-flex-start, dcui-justify-flex-enddcui-flex-item dcui-align-center dcui-justify-space-between
Gapdcui-flex-gap-5 to dcui-flex-gap-30, in steps of 5dcui-flex-gap-15
Griddcui-container-fluid, dcui-row, and dcui-col-xs-1 to dcui-col-xs-12. The sm, md, lg and xl columns apply from 768, 992, 1200 and 1400 px wide.dcui-col-xs-12 dcui-col-md-6
Width and heightdcui-w- and dcui-h- in pixels (10 to 90 in steps of 10, then 100 to 1000 in steps of 50) or percent (10p, 15p, 25p … 95p), plus dcui-w-full, dcui-h-full, dcui-w-0, dcui-full-width and dcui-full-height. There is no 20p or 55p.dcui-w-300, dcui-w-50p, dcui-h-full
Displaydcui-block, dcui-inline-blockdcui-inline-block
TextAlignment: dcui-text-left, dcui-text-center, dcui-text-right. Weight: dcui-text-light, dcui-text-regular, dcui-text-medium, dcui-text-semibold, dcui-text-bold. Colour: dcui-text-success, dcui-text-danger, dcui-text-warning. Wrapping: dcui-text-nowrap, dcui-text-break-all. Links: dcui-text-link.dcui-text-right dcui-text-semibold
Scrollingdcui-scroll-container (vertical, slim scrollbar), dcui-horizontal-scrollable, dcui-no-scrollbardcui-scroll-container dcui-h-400
Formsdcui-form-group, dcui-fld-label, dcui-form-control, dcui-f-l-required (a red required marker), dcui-checkbox-radio-inlinedcui-fld-label
Modifiersdcui-button-no-fill (an outlined button), dcui-large (a taller button or field)class="dcui-button-no-fill" on a dc-button

A summary row built only from kit classes:

template: `
<div class="dcui-row">
<div class="dcui-col-xs-12 dcui-col-md-6 dcui-m-b-15">
<div class="dcui-flex-item dcui-justify-space-between dcui-align-center">
<span class="dcui-text-semibold">Outstanding</span>
<span class="dcui-text-danger dcui-text-bold dcui-text-nowrap">LKR 42,500.00</span>
</div>
</div>
</div>`,

Only use classes that exist in the framework's stylesheets. Classes copied from other apps (for example an app's own prefixed classes) are not loaded for yours and render unstyled.


Theming variables

The kit takes its colours and sizes from CSS custom properties. This section lists the ones that are available. The kit's rules forbid adding new ones, so build with these rather than hard-coded values.

Core variables​

dc-ui-kit.css defines these on :root. They are in the library bundle, which loads before every app's styles.

VariableDefaultUsed for
--dcui-font-family'Lato', Helvetica Neue, helvetica, arial, sans-serifThe page font.
--dcui-regular-font-size14pxText in buttons, fields, checkboxes and tables.
--dcui-body-color#5f6368Body text.
--dcui-primary-color#0097ffButtons, outlined buttons, active and focused states.
--dcui-secondary-color#0670b9Button hover, the active tab's underline, the loading dots.
--dcui-line-color#c8c8c8Borders of fields, icon fields and dropdown panels.
--dcui-grid-gutter15pxColumn padding in dcui-row and dcui-col-*.
--dcui-field-radius5pxCorner radius of fields, buttons and dc-content-card.
--dcui-field-height35pxHeight of fields and buttons. dcui-large adds 5px.
--dcui-photo-bubble-size35pxThe size of DcBubbleAvatar's round photo.
--dcui-success-color#65d353dcui-text-success, a field in its success state, success notices.
--dcui-danger-color#cf4747dcui-text-danger, a field in its error state, error notices.
--dcui-warning-color#ffa434dcui-text-warning.

dc-style.css adds a few --dc-* variables for the framework shell, such as --dc-headings-color (#202124), --dc-regular-panel-radius (10px) and --dc-app-container-padding (20px).

Component variables​

  • Date pickers. base_components.css sets about 55 --dcui-calendar-* variables on :root (colours, sizes and weights of the calendar's days, months, years and input). DcDatepicker, DcDateRangePicker and DcCalendarRangePicker use them.
  • Dashboard. --dcui-dashboard-greeting-color, --dcui-dashboard-heading-color, --dcui-dashboard-avatar-border, --dcui-dashboard-tile-1 to -3 and --dcui-dashboard-backdrop have no :root value: each rule uses a var() fallback. They are the framework's supported way to brand the dashboard. See Dashboard Widgets.

How they apply​

Use the variables in your own CSS with var(), so your few custom rules match the kit:

/* apps/myapp/assets/styles.css, listed in resources.styles of app-config.json */
.myapp-order-summary {
border-top: 1px solid var(--dcui-line-color);
color: var(--dcui-body-color);
}

Every app's stylesheet goes into the one shared assets/app-styles.css, so CSS in your app applies to every page of the system. A :root value that you set for a core variable changes every app, not only yours. Values for the --dcui-calendar-* variables on :root usually don't take effect at all: apps' stylesheets are joined in folder order, so most come before xp_system's, whose :root values then win.

The dark-mode and light-mode classes that XP.addDarkLightTheme() puts on body restyle the framework shell (top bar, sidebar, sign-in screens). The dcui-* styles have no dark-mode variants. See Frontend Runtime (XP).


How to use the kit in admin pages

The admin panel at /api/admin/ has its own copy of the kit, in api/admin/apps/xp_system/components/dc_ui_kit_componenets/. Admin pages import from that copy's registry. From api/admin/apps/myapp/components/, the relative path is the same as in the main app, and it resolves to the admin copy:

import { DcTable, DcPopup } from "../../xp_system/components/dc_ui_kit_componenets/dc_ui_kit_registry.js";

Don't import the main app's kit into admin pages.

The admin registry exports 48 of the 68 components. It doesn't export these 20:

DcActivityFeed, DcAjaxLoader, DcAjaxNotice, DcAppTiles, DcCalendarRangePicker, DcCollapsibleSidePanel, DcCommentFeed, DcDashboardWidget, DcDateRangePicker, DcEmptyState, DcPageHeader, DcPagination, DcPointList, DcQuickLinks, DcRadioGroup, DcSearchDropdown, DcSplitButton, DcStatGroup, DcToggleSwitch and DcTreeNavigation.

The two copies are maintained separately. A component with the same name can lack props or events in the admin copy, and each component's entry on its category page notes this. The admin panel's dc-ui-kit.css is also older and has fewer utility classes. It has the grid, the scrolling and display classes, dcui-full-width, dcui-full-height, the dcui-m-t-*, dcui-m-b-*, dcui-m-l-* and dcui-m-r-* margins, dcui-flex-item, dcui-flex-1, the dcui-align-* and dcui-justify-* classes and the dcui-text-* classes. It has no padding classes, no dcui-w-* or dcui-h-*, no gap classes, no dcui-flex-directions-*, dcui-flex-wrap*, dcui-flex-grow or dcui-flex-shrink, and no dcui-m-0, dcui-m-lr-* or dcui-m-tb-*.

See Admin Pages for building admin pages.


Components

The components are documented on one page per category. Every entry has an example, its props, events, slots and methods, and a note when the admin panel's copy differs.

Component index​

ComponentPageUse it for
DcButtonButtons And LinksThe standard button, including submit buttons
DcIconButtonButtons And LinksA square button with an icon or image, and a loading spinner
DcSplitButtonButtons And LinksA main action with a caret menu of alternatives
DcLinkButtons And LinksA styled text link
DcBoxIconButtons And LinksA Font Awesome icon in a square box
DcInputFieldForm FieldsA single-line text input with a label and an optional icon
DcTextFieldForm FieldsA multi-line text area
DcPasswordFieldForm FieldsA password input with a show/hide toggle
DcPasswordGeneratorForm FieldsA text input with a button that generates a random password
DcSearchFieldForm FieldsA search box that emits the text as the user types
DcFormGroupForm FieldsGrouping a label with its fields
DcCheckboxForm FieldsA single checkbox
DcCheckboxGroupForm FieldsCheckboxes side by side
DcRadioGroupForm FieldsOne choice from a list of radio buttons
DcToggleSwitchForm FieldsAn on/off switch bound to a boolean
DcTagInputForm FieldsFree-text tags, added with Enter
DcSelectSelects And PickersA native select built from an array of options
DcDropdownSelects And PickersA custom dropdown with slots for the label and the options
DcAutoCompleteSelects And PickersA text input that suggests matching options
DcSearchDropdownSelects And PickersA searchable dropdown that can load options page by page
DcTagDropdownSelects And PickersPicking several options, shown as tags
DcDatepickerSelects And PickersA date picked from the kit's calendar
DcNativeDatePickerSelects And PickersThe browser's own date input
DcDateRangePickerSelects And PickersA From/To pair of date pickers bound as one value
DcCalendarRangePickerSelects And PickersA From/To range picked on one calendar popover
DcFontAwesomeIconPickerSelects And PickersSearching for and picking a Font Awesome icon
DcTableData DisplayRows of records, with sorting and row selection
DcPaginationData DisplayPage numbers under a table
DcLoadMoreData DisplayLoading more items as a list or feed is scrolled
DcCardData DisplayA white content box
DcCardPlainData DisplayA card with a top bar (left and right) and a body
DcInfoPanelData DisplayA card with a top section and a two-column body
DcPointListData DisplayA vertical list with a dot per item
DcBubbleAvatarData DisplayA round profile photo
DcEmptyStateData DisplayThe "nothing here" message for a table, list or picker
DcActivityFeedData DisplayA record's history, newest first, with paging
DcCommentFeedData DisplayA record's comment thread, with the box to write one
DcTabsNavigation And LayoutTabs that switch between panels
DcCategoryTabsNavigation And LayoutA tab strip with optional icons and an actions area
DcNavigationDrawerNavigation And LayoutA sidebar list of links
DcBreadcrumbsNavigation And LayoutA trail of router links
DcTreeNavigationNavigation And LayoutA tree of nodes that can expand, with optional lazy loading
DcPageHeaderNavigation And LayoutThe banner at the top of a section, with a title, description, icon and actions
DcCollapsibleSidePanelNavigation And LayoutA side panel that folds down to a thin rail
DcBlueHeaderBarNavigation And LayoutA light blue bar with left and right slots
DcCardBlueContainerNavigation And LayoutThe same light blue bar as DcBlueHeaderBar
DcPopupFeedback And OverlaysA modal dialog, such as a delete confirmation
DcLoaderBarFeedback And OverlaysA thin animated bar while something loads
DcProgressBarFeedback And OverlaysProgress as steps done or a percentage
DcAjaxLoaderFeedback And OverlaysAnimated dots while a request runs
DcAjaxNoticeFeedback And OverlaysA short success or error message after a request
DcImageUploaderMediaDrag-and-drop upload of several files, with previews
DcImageUploaderMiniMediaA compact uploader with thumbnails
DcMediaViewerMediaAttachment thumbnails that open in a lightbox
DcDashboardWidgetDashboard ComponentsThe card a dashboard widget sits in, with a loader
DcAppTilesDashboard ComponentsA grid of app tiles with icons
DcQuickLinksDashboard ComponentsA row of links, each an icon and a label
DcStatGroupDashboard ComponentsLarge numbers with labels, side by side
DcConfLogoFramework ScreensThe DoCloud Framework logo on setup screens
DcConfDevLogoFramework ScreensThe DoCloud Developer logo
DcConfFooterFramework ScreensThe copyright footer with a privacy policy link
DcConfCardFramework ScreensThe body panel of a setup screen
DcConfTimelineFramework ScreensA step indicator for a multi-step setup
DcConfCheckListFramework ScreensA list of checklist items
DcConfCheckListItemFramework ScreensOne checklist row, with a status indicator
DcConfNeedSupportFramework ScreensThe "Need Support? Contact us" line
DcDoCloudLogoFramework ScreensThe DoCloud logo on its own
DcAuthFooterFramework ScreensThe "Powered by DoCloud" footer line

The kit's actions: the standard DcButton, the square DcIconButton, DcSplitButton for a main action with a menu of alternatives, DcLink for a styled text link and DcBoxIcon for a Font Awesome icon in a square box. See Buttons And Links.

Form Fields​

The inputs a form is built from: single-line and multi-line text, password fields with show/hide and a generator, a search box, checkboxes, radio groups, a toggle switch and free-text tags. DcFormGroup and DcCheckboxGroup lay fields out. See Form Fields.

Selects And Pickers​

Fields where the user picks rather than types: a native select, a custom dropdown with slots, autocomplete, a searchable dropdown that can load pages from the server, a multi-select shown as tags, single dates, date ranges and a Font Awesome icon picker. See Selects And Pickers.

Data Display​

Components that show records: DcTable with sorting and row selection, DcPagination and DcLoadMore for paging, cards and info panels, a point list, round avatars, the empty state, and a record's activity and comment feeds. See Data Display.

Components that move the user around an app and frame its pages: tabs, category tabs, a navigation drawer, breadcrumbs, a lazy-loading tree, a page header, a collapsible side panel and light blue header bars. See Navigation And Layout.

Feedback And Overlays​

Components that tell the user what is happening: DcPopup for dialogs and delete confirmations, a loading bar, a progress bar, the loading dots shown while a request runs and the notice shown after it. See Feedback And Overlays.

Media​

File upload and display: DcImageUploader for drag-and-drop upload of several files with previews, the compact DcImageUploaderMini, and DcMediaViewer for attachment thumbnails that open in a lightbox. See Media.

Dashboard Components​

The pieces the framework dashboard is built from: the widget card, app tiles, quick links and a group of statistics. Use them in your own dashboard widgets (see Dashboard Widgets). See Dashboard Components.

Framework Screens​

The branded pieces of the framework's own setup and sign-in screens: DoCloud logos, footers, a setup card, a step timeline, a checklist and the support line. Use them when your app adds a screen of the same kind. See Framework Screens.