You can apply Turnkey stylesheet classes to controls in a ViewModel to give buttons, text, tables, search fields, tabs, and page headers a consistent web UI; this page is for MDriven Designer users who configure those classes in the ViewModel Editor.
Use stylesheet classes in a ViewModel
A stylesheet class is a CSS class that controls presentation in the Turnkey web client. Add the class name to the control's style ref in the ViewModel Editor.
For example, apply primary outlined to an action to render it as a primary outlined button. Apply tk-primary to a text-bearing control when you want the text to use the SciFree primary color.
Use the right class family: modifier classes such as primary, outlined, and flat are for buttons and links. Use tk--prefixed classes when styling text, for example tk-primary or tk-bold.
Apply a class
- Open the ViewModel in the ViewModel Editor.
- Select the control, action, table column, or GroupBox that you want to style.
- Enter the required class or classes in its style ref. Separate multiple classes with spaces.
- Run the ViewModel in Turnkey and check the result at the target screen size.
A style ref can also be an expression when the class must change with ViewModel state. The search-field example later on uses this approach.
For custom selectors, the rendered Turnkey layout, and control-type CSS classes, see Documentation:Layout and CSS. For defining and assigning your own Turnkey CSS styles, see HowTos:Define and Set CSS Styles in MDriven Turnkey and Documentation:Turnkey Styling.
Text and status emphasis
Use tk--prefixed classes to communicate emphasis in text.
| Goal | Style ref example | Example use |
|---|---|---|
| Make the main value stand out | tk-bold
|
Apply it to the column that displays an object's primary name. |
| Use the SciFree primary color | tk-primary
|
Apply it to a status label or a key text column. |
You can use chips in a table to make a status or process stage more visible. For example, display a pending status using the applicable chip styling together with the text Pending. Choose colors that communicate a defined state rather than using color as decoration; the state remains understandable when the text is also present.
Available text emphasis classes and their applications:
|
Status indicator classes for reporting and process stages:
Buttons and linksTurnkey supports three button forms: default, outlined, and flat. You can combine a color modifier with an optional form modifier in the style ref. Do not add a
Use You can also use colors like primary (main SciFree color), danger, or success. For more colors, follow the Turnkey Style System. Special buttonsYou can add special-button classes on top of the button modifiers when the stylesheet provides a Material Design icon for that action. For an icon-only action, remove the action name so the button displays the standalone icon without text. Use icon-only buttons only where the icon's purpose is clear in the surrounding UI. For example, use a remove icon at the end of a listed affiliation, while retaining a text label for a less familiar action. Examples of special button classes with their style references:
Add icons to other elementsSpecial icon classes can be applied to elements other than buttons. Apply the relevant icon class in the element's style ref. The available icon-class names must come from the current Turnkey stylesheet. Available icon classes for use in element style refs:
Information bannersAn information element can be static or removable. Use Types of information elements available for different use cases: Create a static information banner
Make the banner removableUse a Boolean ViewModel variable to track whether the user has dismissed the banner.
vRemoveInfo := true
The visibility rule must be the inverse of the dismissal variable. If the GroupBox is visible only when Tables, cards, and listsUse style refs on table columns and GroupBoxes to communicate hierarchy without changing the underlying ViewModel data. TablesA table can omit its heading by adding the
Reporting states can use icon modifier classes. You can leave the icon at its default grey, or combine it with Table styling classes and their visual presentation:
Card wrappersUse a GroupBox as a card wrapper by setting its style ref to For example, place a person's summary fields inside a card GroupBox and hide the GroupBox heading when the person's name is already shown in the card body. Lists based on tablesYou can present a table as a list. For a list of affiliations:
This pattern keeps the document name readable and gives each row a compact remove control. Available list style variants:
Search with a dropdown of suggestionsUse Build the search box
Change the input style while results are shownSet the search input style ref as an expression. This example adds if not vSeekParam.isNullOrEmpty and not (vSeekerResult->size <= 0) then 'tk-searchbox__input tk-searchbox--searching' else 'tk-searchbox__input' endif
Use the actual result collection, Configure the results dropdown
not vSeekParam.isNullOrEmpty and not (vSeekerResult->size <= 0)
Add the selected suggestionIf the result row has an add action, set its style ref to vCurrent_SearchResultGrid;/*Choose the current row in the results grid*/
vCurrent_Something.Something.add(vCurrent_SearchResultGrid); /*Main action*/
vSeekParam := String.NullValue /*Clean the search input field*/
Replace You can configure a server-side search action to run every 30 ms only when the search field is not empty. Set its DisabledExpression to: vSeekParam->isEmpty
Test this interval against the size and cost of your search. The disabled expression prevents calls while the input is empty, but it does not reduce calls while the user is typing. Tabs made from a GroupBoxYou can build a tab group from a GroupBox and actions when each tab opens a separate page or view.
For example, on a Details page, disable Details and give it Visual examples of tab group implementation and styling: Page headers and subheadersCreate a page header and subheader with two table columns.
For example, use Responsive and custom stylingStyle refs select classes; custom CSS controls the rules behind those classes. Turnkey also exposes the ViewModel name high in the rendered HTML hierarchy, so custom CSS can target one ViewModel without affecting other views. For example, a rule scoped under a ViewModel named When you configure theme values with small, medium, and large values, blank values fall back to the existing applicable value. Use this capability for intentional size changes across device categories, and verify the result on mobile, medium, and desktop layouts. Access the complete stylesheet with all style classes and rules: You can download the CSS file here (stylesheet) that contains all the style data with the latest changes. See also |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||























