Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Examples of badges containing text, using primary and secondary colors. The badge is applied to its children.
Alert component for Universal Dashboard.
Alerts provide a simple way to communicate information to a user.
Alerts have four different severities and can include text or other content.
Alerts can contain any component and also a title.
Chip component for Universal Dashboard.
Chips are compact elements that represent an input, attribute, or action.
Chips allow users to enter information, make selections, filter content, or trigger actions.
While included here as a standalone component, the most common use will be in some form of input, so some of the behavior demonstrated here is not shown in context.
Shows a toast when the chip is clicked.
Icon component for Universal Dashboard
icons to include in your dashboard. Icon names are slightly different than those shown on the FontAwesome website. For example, if you want to use the network-wired
icon, you would use the following string.
We include FontAwesome v6 with PowerShell Universal. You can use Find-UDIcon
to search through the list of included icons.
The UniversalDashboard.FontAwesomeIcons
enum should not be used and is only included for backwards compatibility. Many of the icons are no longer a part of FontAwesome 6.
Create icons by specifying their names. You can use the icon reference below to find icons.
Set the size of the icon. Valid values are: xs
, sm
, lg
, 2x
, 3x
, 4x
, 5x
, 6x
, 7x
, 8x
, 9x
, 10x
Rotate icons. The value represents the degrees of rotation.
Add a border to your icon.
Apply CSS styles to your icon.
Within your dashboard, call the icon cmdlet.
Date and time component for Universal Dashboard.
The New-UDDateTime
component is used for formatting dates and times within the client's browser. By using the client's browser, you can format the time based on the local time zone and locale settings for the user.
The date and time component uses DayJS. For a full list of custom formatting options, visit the .
By default, the date and time will be formatted using the LLL
localized formatting template.
Resulting output: August 16, 2018 8:02 PM
You can specify custom formatting strings using the .
Resulting output: 25/01/2019
You can specify the locale to display the date and time in.
Resulting output: 13 de septiembre de 2022 7:30
Data grid component for Universal Dashboard.
The UDDataGrid
component is an advanced version of the table that is useful for displaying large amounts of data. It supports many of the same features as the table but also provides complex filtering, row virtualization, multi-column sort and more.
Data grids load their data via the -LoadRows
event handler. You will need to return a hashtable that contains the row data and the total number of rows.
Columns are defined using hashtables.
Prior to version 3.3., column field names must be in camel case. For example, the property Name
would need to be name
while the property FirstName
would need to be firstName
.
Columns are customizable using hashtables. You can find the supported properties below.
You can render custom components in columns by specifying render
within the column hashtable. You can access the current row's data by using the $EventData
or $Row
variable
In this example, the number is shown in the name column with a New-UDTypography
component.
Column fluidity or responsiveness can be achieved by setting the flex
property of a column.
The flex
property accepts a value between 0 and ∞. It works by dividing the remaining space in the grid among all flex columns in proportion to their flex
value.
For example, consider a grid with a total width of 500px that has three columns: the first with width: 200
; the second with flex: 1
; and the third with flex: 0.5
. The first column will be 200px wide, leaving 300px remaining. The column with flex: 1
is twice the size of flex: 0.5
, which means that final sizes will be: 200px, 200px, 100px.
To set a minimum and maximum width for a flex
column set the minWidth
and the maxWidth
property on the column.
The -LoadRows
parameter is used to return data for the data grid. Table state will be provided to the event handler as $EventData
. You will find the following properties within the $EventData
object.
To implement paging, you can access the page
and pageSize
properties of the $EventData
variable.
The filter hashtable is included in the $EventData
for the -LoadRows
event handler when a filter is defined. The hashtable has a structure as follows.
The items property contains an array of columns, operators and values. You can use these to filter your data.
The link operator field is used to specify the link between the filters. This can be and
or or
.
The $EventData
object will contain a Sort
property when the user sorts the data grid. It contains properties for each column that is sorted. The properties will start as 0 and increment as more columns are sorted.
For example, you can access the first sorted column as follows.
You will also receive the sort direction for each column.
You can use the -LoadDetailedContent
event handler to display additional information about the row you are expanding. Information about the current row is available in $EventData.row
.
Tables provide editor support by specifying the -OnEdit
event handler. The new row data will be provided as $EventData
. You can chose to return updated row information (for example, adjusting something the user has entered) and return it from the event handler. If you do not return anything, the row will reflect what the user entered.
The $EventData
has the following format.
Ensure that you provide the editable
property to each column you wish for the user to edit.
To override the default export functionality, use the -OnExport
event handler. $EventData
will be an array of rows with their values. You should use Out-UDDataGridExport
to return the data from -OnExport
.
In this example, we generate an array of 10,000 records. We will create a new function, Out-UDDataGridData
to manage the paging, sorting and filtering.
In this example, we'll query the PowerShell Universal database with dbatools.
List component for Universal Dashboard.
Lists are continuous, vertical indexes of text or images.
Lists are a continuous group of text or images. They are composed of items containing primary and supplemental actions, which are represented by icons and text.
You can define an action to take when an item is clicked by using the -OnClick
parameter of New-UDListItem
.
You can use custom icon sets available on the page. First, install the module and then use the icon with other components.
Align
How to align the data within the column.
Left, Center, Right
CellClassName
A CSS class to apply to cells in this column
string
ColSpan
The number of columns this column should span.
Integer
Description
A tooltip description of the column
string
DisableColumnMenu
Disable the column menu for this column
boolean
DisableExport
Disable exporting of the data in this column
boolean
Editable
Whether or not this column can be edited
boolean
Field
The field (property) to use when displaying the value in the column.
String
Filterable
Whether this column can be used in filters.
boolean
Flex
The flex
property accepts a value between 0 and ∞. It works by dividing the remaining space in the grid among all flex columns in proportion to their flex
value.
float
HeaderAlign
How to align header text.
left, center, right
HeaderName
The title to display in the header.
String
Hide
Whether to hide the column
boolean
Hideable
Whether a column can be hidden by the user.
boolean
HideSortIcon
Whether to hide the sort icon for the column
boolean
MaxWidth
The maximum width of the column
integer
MinWidth
The minimum width of the column
integer
Pinnable
Whether the column can be pinned.
boolean
Render
A script block to render components in the column
ScriptBlock
Resizable
Whether the column can be resized
boolean
Sortable
Whether the column can be sorted.
boolean
Type
The type of data within the column
string, number, date, dateTime, boolean, actions
Width
How wide the column should be in pixels.
Integer
Filter
A filter object that you can use to construct filters against your data.
Hashtable
Page
The current page. Starts at 0.
Integer
PageSize
The number of records in a page.
Integer
Sort
The sort options for the table
Hashtable
ColumnField
The name of the field to filter
String
OperatorValue
The type of operator to use when filtering the data.
String
Value
The value used to filter
Object
Field
The field to sort.
String
Sort
The direction to sort the field.
asc, desc
Tooltip component for PowerShell Universal.
Tooltips display informative text when users hover over an element.
Place the tooltip on top
, bottom
, left
or right
.
Tooltip content can contain any UD element.
Tooltips can be over various types including: "dark", "success", "warning", "error", "info", "light"
Tree view component for Universal Dashboard.
New-UDTreeView
allows you to create a tree of items and, optionally, dynamically expand the list when clicked.
Create a basic tree view by using the New-UDTreeNode
cmdlet.
Dynamic tree views allow you to run PowerShell whenever a node is clicked. You can then return a list of nodes that should be rendered underneath the clicked node. You can also take other actions such as opening a modal or showing a toast.
Typography component for Universal Dashboard
Use typography to present your design and content as clearly and efficiently as possible.
Too many type sizes and styles at once can spoil any layout. A typographic scale has a limited set of type sizes that work well together along with the layout grid.
You can use the -Style
parameter to define colors for your text.
You can use theme-based styling by using the -Sx
parameter of New-UDTypography
. For example, to apply the secondary text color, you can use the following syntax.
Table component for Universal Dashboard
Tables display sets of data. They can be fully customized.
Tables display information in a way that’s easy to scan, so that users can look for patterns and insights. They can be embedded in primary content, such as cards.
A simple example with no frills. Table columns are defined from the data.
Define custom columns for your table.
Define column rendering. Sorting and exporting still work for the table.
Column width can be defined using the -Width
parameter. You can also decide to truncate columns that extend past that width.
You can configure custom filters per column. The table supports text
, select
, fuzzy
, slider
, range
, date
, number
, and autocomplete
filters.
To enable search, use the -ShowSearch
parameter on New-UDTable
.
When using custom columns, you will need to add the -IncludeInSearch
parameter to the columns you'd like to include in the search.
Process data on the server so you can perform paging, filtering, sorting and searching in systems like SQL. To implement a server-side table, you will use the -LoadData
parameter. This parameter accepts a ScriptBlock
. The $EventData
variable includes information about the state of the table. You can use cmdlets to process the data based on this information.
The $EventData
object contains the following properties.
You may want to allow the user to take action on the current set of displayed data. To do so, use Get-UDElement
in the input object you want to retrieve the data from and get the table by Id. Once you have the element, you can use the CurrentData
property of the element to get an array of currently displayed rows.
By default, paging is disable and tables will grow based on how many rows of data you provide. You can enable paging by using the -ShowPagination
cmdlet (alias -Paging
). You can configure the page size using the -PageSize
cmdlet.
By default, the page size selector provides an option to show all rows. If you want to prevent users from doing this, use the -DisablePageSizeAll
cmdlet.
You can change the location of the pagination control by using the -PaginationLocation
parameter. It accepts top, bottom and both.
To enable sorting for a table, use the -ShowSort
parameter. When you enable sorting, you will be able to click the table headers to sort the table by clicking the headers. By default, multi-sort is enabled. To multi-hold shift and click a column header.
You can control which columns can be sorted by using New-UDTableColumn
and -ShowSort
parameter.
By default, the sorting of a table has 3 states. Unsorted, ascending and descending. If you would like to disable the unsorted state, use the -DisableSortRemove
parameter of New-UDTable
.
Tables support selection of rows. You can create an event handler for the OnRowSelected
parameter to receive when a new row is selected or unselected or you can use Get-UDElement
to retrieve the current set of selected rows.
The following example creates a table with row selection enabled. A toast is show when clicking the row or when clicking the GET Rows button.
The $EventData
variable for the -OnRowSelected
event will include all the columns as properties and a selected property as to whether the row was selected or unselected.
For example, the service table data would look like this.
You can include additional information within the table by using the -OnRowExpand
parameter of New-UDTable
. It accepts a ScriptBlock that you can use to return additional components.
Tables support exporting the data within the table. You can export as CSV, XLSX, JSON or PDF. You can define which columns to include in an export and choose to export just the current page or all the data within the table.
Hidden columns allow you to include data that is not displayed in the table but is included in the exported data.
The following hides the StartType column from the user but includes it in the export.
You can control the export functionality with a PowerShell script block. This is useful when exporting from server-side sources like SQL server tables.
In this example, I have a SQL table that contains podcasts. When exporting, you will receive information about the current state of the table to allow you to customize what data is exported.
You can decide which export options to present to your users using the -ExportOption
cmdlet. The following example would only show the CSV export option.
You can use the -TextOption
parameter along with the New-UDTableTextOption
cmdlet to set text fields within the table.
You can externally refresh a table by putting the table within a dynamic region and using Sync-UDElement
.
This example creates a button to refresh the table.
If you use the -LoadData
parameter, you can sync the table directly. This has the benefit of maintaining the table state, such as the page and filtering, after the refresh.
You can use the -ShowRefresh
parameter to provide a refresh button for server-side tables.
You can use a theme to create a table with alternating row colors.
Filters
Hashtable[] @{ id = 'fieldName'
value = 'filterValue' }
A list of filter values. Each hashtable has an Id
and a Value
property.
OrderBy
Hashtable @{ field = "fieldName" }
Property name to sort by.
OrderDirection
string
asc
or desc
depending on the sort order.
Page
int
The current page (starting with 0).
PageSize
int
The selected page size.
Properties
string[]
An array of properties being shown in the table.
Search
string
A search string provided by the user.
TotalCount
int
The total number of records before filtering or paging.