Skip to main content

ui

Routines for building UI

Namespaces

NamespaceDescription
cards-
css-
forms-
hintsVisual hints attached to an element. They can be used to introduce a new app to users.
input-
labels-
panels-
time-
tools-

Classes

ClassDescription
EntityMetaDartProxyOverride the corresponding methods, and register an instance to let Datagrok know how to handle objects of the specified type.
ObjectHandlerOverride the corresponding methods, and register an instance to let Datagrok know how to handle objects of the specified type.
ObjectHandlerResolutionArgs-
toolsUI Tools *
TooltipRepresents a tooltip.

Interfaces

InterfaceDescription
IDragAndDropOptionsOptions for makeDroppable. All callbacks are optional; pass only what you need.
ITooltipOptionsOptions for tooltip display. Future-proof — add fields here as tooltip features grow.
RangeSliderOptionsOptions of rangeSlider: [minRange]..[maxRange] is the full extent, [min]..[max] the selected part (the whole extent when omitted).

Variables

VariableDescription
icons-
tooltip-

Functions

FunctionDescription
_backColorInternal helper to set background color and return the element for chaining. Prefer using CSS classes for styling.
_classInternal helper to add a CSS class and return the element for chaining. Prefer using ui.element() with className parameter or standard classList API.
_colorInternal helper to set text color and return the element for chaining. Prefer using CSS classes for styling.
_innerTextInternal helper to set element inner text and return the element for chaining. Prefer using standard DOM APIs or ui.div/ui.span with content directly.
accordionCreates an accordion with dynamically populated panes. Example: https://public.datagrok.ai/js/samples/ui/components/accordion
actionLinkA link-styled label that runs [onClick].
appendAllAppends multiple elements to root, and returns root. An element could be either HTMLElement or Viewer.
bigButtonA large (primary) button.
bindBinds [item] with the [element]. It enables selecting it as a current object, drag-and-drop, tooltip, and popup menu.
bindInputsKeeps the string values of [inputs] in sync: a change in one is copied to the others.
blockExample: https://public.datagrok.ai/js/samples/ui/containers/blocks
block25Example: https://public.datagrok.ai/js/samples/ui/containers/blocks
block50Example: https://public.datagrok.ai/js/samples/ui/containers/blocks
block75Example: https://public.datagrok.ai/js/samples/ui/containers/blocks
boxExample: https://public.datagrok.ai/js/samples/ui/containers/box
boxFixedA box that does not grow with its flex container.
breadcrumbsExample: https://public.datagrok.ai/js/samples/ui/components/breadcrumbs
buttonCreates a button with the specified text, click handler, and tooltip. Example: https://public.datagrok.ai/js/samples/ui/components/buttons
buttonsInputA form row holding [children] buttons, aligned with the input column.
canvasCreates a canvas element, optionally sized to width × height pixels (both CSS and bitmap size).
cardRenders content as a card.
colorPickerCreates a color picker bound to colorDiv: clicking the element opens the picker, and its background updates live to preview the selected color.
comboPopupCreates a combo popup with the specified icons and items. Example: https://public.datagrok.ai/js/samples/ui/components/combo-popup
comboPopupItemsCreates a combo popup with the specified icons and items
composeEmailCreates an email dialog with editable subject/to/bcc, a markdown body, and attachment management.
contextActionsThe context actions (menu commands) applicable to [x], rendered as a list.
dialogCreates a [Dialog]. Example: https://public.datagrok.ai/js/samples/ui/containers/splitters
div-
divHDiv flex-box container that positions child elements horizontally. Example: https://public.datagrok.ai/js/samples/ui/containers/flexbox
divTextReturns DivElement with the specified inner text. Example: https://public.datagrok.ai/js/samples/ui/components/typography
divVDiv flex-box container that positions child elements vertically. Example: https://public.datagrok.ai/js/samples/ui/containers/flexbox
dropDownCreates a dropdown component. The most common use case is a menu dropdown.
elementCreates an instance of the element for the specified tag, and optionally assigns it a CSS class.
emptyRemoves all child nodes, and disposes widgets that these nodes might contain. See also [remove].
extractRootResolves a widget, an object with a root, or a cash/jQuery set to its DOM element; other values pass through.
fileBrowserExample: https://public.datagrok.ai/js/samples/ui/components/file-browser
formCreates a form: a vertical list of labeled inputs with auto-sized labels. options.layout picks the variant: 'narrow' puts labels above the inputs, 'wide' lays the inputs out in two columns. autosize is accepted for compatibility and ignored.
h1Example: https://public.datagrok.ai/js/samples/ui/components/typography
h2Example: https://public.datagrok.ai/js/samples/ui/components/typography
h3Example: https://public.datagrok.ai/js/samples/ui/components/typography
iconAn icon by name: Font Awesome by default ('plus'), an SVG icon for .svg names or style: 'svg', an image for a URL, an absolute path or a data URI. See also icons for the common ones. Example: https://public.datagrok.ai/js/samples/ui/components/icons
iconFAReturns a font-awesome icon with the specified name, handler, and tooltip. Example: https://public.datagrok.ai/js/samples/ui/components/icons
iconFABSame as iconFA but also blue.
iconImageAn icon with a background image: [path] is a URL, an absolute path, a data URI, or a file name under /images/.
iconSvgCreates an icon for the SVG image Usage: - iconSvg('ai.svg') would map to /images/ai.svg - iconSvg('ai') would map to the svg-ai class
iframeExample: https://public.datagrok.ai/js/samples/ui/components/iframe
imageExample: https://public.datagrok.ai/js/samples/ui/components/image
infoExample: https://public.datagrok.ai/js/samples/ui/components/info-bar
inlineTextRenders inline text, calling [renderMarkup] for each non-HTMLElement. Example: https://public.datagrok.ai/js/samples/ui/components/typography
inputsA form built from [inputs]; same as form.
inputsRowA labeled row that lays [inputs] out horizontally.
labelExample: https://public.datagrok.ai/js/samples/ui/components/typography
linkCreates an <a> element.
listCreates a visual element representing list of [items]. Example: https://public.datagrok.ai/js/samples/ui/components/list
loaderExample: https://public.datagrok.ai/js/samples/ui/components/loading-indicators
makeDraggableExample: https://public.datagrok.ai/js/samples/ui/interactivity/drag-and-drop
makeDroppableMakes [e] a drop target; see IDragAndDropOptions for the callbacks.
markdownExample: https://public.datagrok.ai/js/samples/ui/components/markdown
narrowFormSame as form with layout: 'narrow': labels above the inputs.
onSizeChangedExample: https://public.datagrok.ai/js/samples/ui/ui-events
pExample: https://public.datagrok.ai/js/samples/ui/components/typography
panelExample: https://public.datagrok.ai/js/samples/ui/containers/panels
patternsInputLegend editor for categorical color patterns ({category: color}).
pickTableFromFilesOpens the platform's 'Select a file' dialog over the file shares tree. Resolves with the first dataframe of the picked file, or null when the dialog is closed without a pick.
pickTableFromQueryOpens the platform's 'Select a database query' dialog; running a query that produces a dataframe resolves with it, closing without one resolves with null.
popupMenuExample: ui.popupMenu({ 'About': () => grok.shell.info('About'), 'File': { 'Open': () => grok.shell.info('Open'), 'Close': () => grok.shell.info('Close'), } });
rangeSliderA two-thumb slider over [minRange]..[maxRange] with [min]..[max] selected. Example: https://public.datagrok.ai/js/samples/ui/components/range-slider
removeRemoves the [element] from the DOM, and disposes any widgets that the [element] might contain. See also [empty].
renderRenders object to html element.
renderCardRenders object to html card.
renderInlineRenders [x] through its ObjectHandler markup renderer, falling back to render.
ribbonPanelTypically, this is a host for the icons.
schemeInputEditor for a linear color scheme (a gradient of ARGB colors).
setClassAdds [classes] to [e] when [flag] is true, removes them otherwise.
setDisabledDisables or enables [element] (adds d4-disabled); an optional tooltip explains why it is disabled.
setDisplayShows or hides [element] by toggling its display style.
setDisplayAllShows or hides all [elements].
setUpdateIndicatorSets an update indicator on the specified element. Example: https://public.datagrok.ai/js/samples/ui/components/update-indicator
showColorPickerOpens a standalone color picker modal immediately, without a trigger element. Use when there is no persistent UI element to bind to (e.g. editing a canvas-rendered grid cell).
showPopupShows popup with the [element] near the [anchor]. tooltip, and popup menu.
spanRenders multiple objects as a span
splitHPositions child elements horizontally and allows you to resize them. Example: https://public.datagrok.ai/js/samples/ui/containers/splitters
splitVPositions child elements vertically and allows you to resize them. Example: https://public.datagrok.ai/js/samples/ui/containers/splitters
starA "favorite" star toggle for the entity with the given [id].
tabControlExample: https://public.datagrok.ai/js/samples/ui/components/tab-control
tableCreates a visual table based on [items] and [renderer]. Note: the ind passed to [renderer] is 1-based (HTML table row indexing), not 0-based.
tableFromMapCreates an html table based on [map]. Example: https://public.datagrok.ai/js/samples/ui/components/html-tables
tableFromPropertiesCreates an editable html table for the specified items (rows) and properties (columns).
tagsRenders the tags of an entity as chips.
toggleButtonCreates a toggle button (d4-toggle-button). When clicked, marks itself as current (d4-current) and clears that class from sibling toggle buttons under the same parent. Wrap a set of these in toggleButtonGroup to get the group container styling.
toggleButtonGroupWraps a list of toggleButtons in a vertical d4-toggle-button-group container.
treeCreates new nodes tree. Example: https://public.datagrok.ai/js/samples/ui/components/tree-view
typeAheadA text input with type-ahead suggestions; see TypeAheadConfig.
virtualViewCreates a virtual list widget. Example: https://public.datagrok.ai/js/samples/ui/views/virtual-view
waitWaits for Future<Element> function to complete and collect its result. Example: https://public.datagrok.ai/js/samples/ui/components/loading-indicators
waitBoxWaits for Future<Element> function to complete and collect its result as a ui.box. Example: https://public.datagrok.ai/js/samples/ui/components/loading-indicators
wideFormSame as form with layout: 'wide': inputs in two columns.