Data Visualization




Map

Default


This kit provides a wrapping class to place around the MapLibre library. Complete docs for using the library can be found here.

Basic setup to start using MapLibre:

  • Install the npm package using yarn add maplibre-gl
  • To include the maplibre css, include a link to the CSS file as a CDN in your stylesheet using the following syntax: @import url("https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css"); OR include it as a link in the tag <link href='https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css' rel='stylesheet' />
  • You can now use MapLibre within the Map Kit as shown in this example.

Notes :

  • To enable custom buttons, set zoomBtns and flyTo to true and pass in zoomInClick, zoomOutClick and flyToClick as shown in this doc example.
  • Use mapTheme.marker to set the Marker color.
  • To use Maplibre, you must also set a height and width to the containing div (.pb_map) and set position to 'relative'.
  • scrollZoom has been disabled in these doc examples for page usability
Map With Polygon Draw Plugin


Various plugins are available for use with MapLibre, one of which is the mapbox-gl-draw. This plugin is recommended by MapLibre if you need to add the functionality of drawing polygons on the map.

To test this tool:

  • Click the "draw box" icon to activate the polygon tool
  • Click on a spot on the map to start drawing
  • Continue clicking to create new points, defining the boundaries of the polygon
  • Press enter or re-click the first point to finish the polygon
  • Once drawn, polygons can be selected on click and then moved, by dragging-and-dropping the entire shape; resized, by dragging-and-dropping any boundary point(s); or deleted, by clicking the "trash" button.
Map With Custom Button


If you want to add custom buttons to the Map, you can use the MapCustomButton component nested inside Map.Controls as shown in the code snippet below. Note that when Map.Controls is used in this way, the props for the rest of the buttons must also be passed to Map.Controls instead of the Map itself.

Table

Small


Use table size "sm" when data density is a priority. Smaller row height enables the user to view more data without the need for scrolling.

Table can leverage the max-width property. Learn more in our visual guidelines.

Medium


Use table size "md" to add padding around each row to increase reading comfortability.

Large


Use table size "lg" to add padding around each row to maximize reading comfortability.

Sticky Header


React: Use sticky on a table to allow the table header to be fixed in place when the user scrolls up and down on the page.

Rails: Pass sticky: true to props.

If the table header is not sticking in the right place you will need to pass a inline top style to the thead.
React Example: <thead style={{ top: "-16px" }}>
Rails Example: <thead style="top: -16px">

Troubleshooting CSS Problems

Sticky may not work if any parent/ancestor of the sticky element has any of the overflow properties set. Additionally, specifying a height on the overflowing container provides measurement for this feature to work properly. In some cases, it may be necessary to set the same parent/ancestor container to position: static as well.

Sticky Left Column


The stickyLeftColumn prop expects an array of the column data-sticky-ids you want to be sticky. Make sure to add the corresponding data-sticky-id to the <th> and <td>.

If you are using the sub-component variant, then you will pass the data-sticky-id to <Table.Header> and <Table.Cell>

Please ensure that unique data-sticky-ids are used for all columns across multiple tables. Using the same columns data-sticky-ids on multiple tables can lead to issues when using stickyLeftColumn prop.

Sticky Right Column


The stickyRightColumn prop works in the same way as the above stickyLeftColumn prop. It expects an array of the column data-sticky-ids you want to be sticky. Make sure to add the corresponding data-sticky-id to the <th> and <td>.

If you are using the sub-component variant, then you will pass the data-sticky-id to <Table.Header> and <Table.Cell>

Please ensure that unique data-sticky-ids are used for all columns across multiple tables. Using the same columns data-sticky-ids on multiple tables can lead to issues when using the stickyRightColumn prop.

Sticky Left and Right Columns


The stickyLeftColumn and stickyRightColumn props can be used together on the same table as needed.

Please ensure that unique data-sticky-ids are used for all columns across multiple tables. Using the same columns data-sticky-ids on multiple tables can lead to issues when using props.

Row Alignment


Pass our textAlign global prop to any table.row subcomponent to change the text alignment of all cells within that row.
The header/ first row is the default, followed by the second row being centered, and then the last row shifted to the right.

Cell Alignment


Pass our textAlign global prop to any table.cell subcomponent to change the text alignment of individual cells, or apply this prop persistently to align entire columns.
In the table above the "Rating" column contents is centered and the "Money" column contents is right aligned.

Row Shift


Pass our verticalAlign global prop to any table.row subcomponent to change the vertical alignment of all cells within that row.

Cell Shift


Pass our verticalAlign global prop to any table.cell subcomponent to change the text alignment of individual cells, or apply this prop persistently to align entire columns.
The first table shifts "Total" down, whereas the second table shifts the "Espresso Drinks" column contents up.

Side Highlight


Side highlight can take product, status, and category colors. To view full list of colors, visit token colors.

Note: Only use category colors for categories. Do not mix it with product or status colors.

Table Container Off


Disable Hover


Multi-line


Force Single Line


Data Table


Tighter spacing in first- and last-child cells of each row for data-heavy tables.

Responsive Tables


Table with 1 Action


If there is one button on each row of the table, ideally, it should use the secondary variant and be placed at the end of the row

Table with 2 Actions


If there are two actions on each of the row, one should ideally one should use the secondary variant and the other use the link variant. The button using the secondary variant should be placed at the end.

Table with 2+ Actions


If there are more than two actions on each row, then they should be contained in secondary circle icon button with the ellipsis-h icon (horizontal ellipsis) at the end of the row

Table with Actions in the Middle


If the button is towards the middle of the table, it should likely use button variant link

Table with Icon Buttons


Icon buttons are great to use if space is limited. If the icon isn’t VERY self explanatory (for example pencil/pen for edit, trashcan for delete) then it should use a tooltip explaining what the action does. The tooltip shouldn’t be longer than a few words and essentially serves as a replacement for what the button would say if it weren’t an icon

Table With Background Kit


Vertical Borders


Striped Table


Optionally pass the striped (boolean, defaults to false) prop to set odd rows to a contrasting background color. This helps with readability on larger tables with lots of data.

Table with Sub Components (Table Elements)


You can optionally build your table using our sub-components, which map to their respective html table elements:

Table.Head = thead
Table.Body = tbody
Table.Row = tr
Table.Header = th
Table.Cell = td

Table with Sub Components (Divs)


Optionally build your table with divs by passing div to the tag prop of all* your sub-components.

*NOTE: The tag prop defaults to table, which returns html elements. If divs are desired, sub-components must be used and all table elements, including the initial kit call, must use div as their tag in order for the table to render properly.

Outer Padding


Pass any of our spacing tokens to the outerPadding / outer_padding prop to customize a table's outer padding (both the left padding of the first column and the right padding of the last column).

Table with Collapsible


The collapsible prop can be used on any Table Row to add a collapsible area. Use the additional collapsibleContent prop to add any content to the collapsible Row.

Table with Collapsible with Custom Click


When using the collapsible prop, the default functionality is that the entire Row will be clickable to toggle the Row. To limit the click event to a specific Table Cell, you can use the toggleCellId prop to pass in the id of the Cell you want to use as the trigger.
NOTE: toggleCellId and the id on the Cell you want to use as the trigger MUST be the same.

Table with Collapsible with Custom Content


Table with Collapsible with Nested Rows


The collapsibleContent can display any content, including nested Table Rows.

Additionally, the collapsibleSideHighlight can also be removed by setting it to false if needed. This prop is set to true by default.

NOTE: We advise against using the disableHover Table prop when nesting Table Rows within a Table.

Table with Collapsible with Nested Table


The collapsibleContent can also be used to display nested Tables within each Row.

NOTE: We advise against using the disableHover Table prop when nesting Tables within a Table.

Table with Clickable Rows


Clickable table rows do not require any additional props. This doc example showcases how to set them up using html_options/htmlOptions and click events. Using the global prop for cursor to set it to "pointer" is also recommended for better UX.

Table with Selectable Rows


Use the Checkbox kit with the Table to achieve the selectable row functionality seen here.

Header Style Borderless


Customize your header by removing the header borders with the headerStyle="borderless" prop.

Header Style Floating


Further customize your header by using the table with background kit logic to give your table header a custom background color. Use the headerStyle="floating" prop to visually nest the borderless table within a card or collapsible with a matching background color (the backgroundColor passed to Background kit should match the background or backgroundColor for the element in which it is nested).

List

Default


Large


Ordered


Borderless


Horizontal Padding


Layout Left


Layout Right


Filter

Default


To display the "No Filters Selected" text, the filters prop must be null. As a suggestion, check the values of each key in your filters object. If they are all falsy, return null.

No Background


To remove the background from a filter, add the prop background with a value of false.

Single


No Sort


To display results, use templates single or default.

Filter Only


Sort Only


Max Width for Popover Inside of Filter


Filter can leverage the max-width property. Learn more in our visual guidelines.

Max Height for Popover Inside of Filter


Filter Placement


Click the filter button above to toggle the popover.

To change the filter's popover position, use the placement prop with one of the positions:
"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end"

Popover Props


This kit uses the Popover kit under the hood for the Filter Popover which comes with its own set of props. If you want to apply certain Popover props to that underlying kit, you can do so by using the optional popoverProps prop. This prop must be an object that contains valid Popover props. For a full list of Popover props, see here.

Sidebar


Distribution Bar

Default


Custom Colors


You can customize the order of the colors you would like to use by using the colors prop. Only the data and status colors will work for Playbook charts. See the design page for reference.

Legend

Default


With Prefix Text


Colors


By default legend kit uses data_1 color.
Pass the color prop and use any desired value from $data_colors, $status_colors, $product_colors and $category_colors list.

Custom Colors


The color prop also allows for use of custom colors passed in as HEX codes.

Gauge

Default


Disable Animation


Title


Units


Use custom CSS with classes or inline styles (as shown in these docs) to customize the appearance of prefix and suffix units.

Full Circle


Min Max Labels


Min defaults to 0, Max to 100.

Sizing


Gauge resizes dynamically to fit whatever element it's placed within.

Note: set overflow to hidden on the parent element when nesting gauges inside of a flex items to best respond to shrinking screens.

Height


Live Data


Color Overrides


Custom data colors allow for color customization to match the needs of business requirements.
Pass the prop plotOptions.solidgauge.borderColor with a Playbook token like colors. + data_1 | data_2 | data_3 | data_4 | data_5 | data_6 | data_7 | data_8. Hex colors are also available eg: #CA0095

Complex


We are able to wrap the Highcharts Gauge kit within Playbook kits (such as Flex and Card components).

Bar Graph

Default


Legend


Legend Position


Prop

align Type: String | Values: left | center | right (defaults to center)
verticalAlign Type: String | Values: top | middle | bottom (defaults to bottom)
layout Type: String | Values: horizontal | vertical | proximate (defaults to horizontal)
x Type: Number (defaults to 0)
y Type: Number (defaults to 0)

  • layout determines the position of the legend items
    layout: proximate will place the legend items as close as possible to the graphs they're representing. It will also determine whether to place the legend above/below or on the side of the plot area, if the legend is in a corner.

  • x offsets the legend relative to its horizontal alignmnet. Negative x moves it to the left, positive x moves it to the right

  • y offsets the legend relative to its vertical alignmnet. Negative y moves it up, positive y moves it down.

Legend Non Clickable


Height


By default, Highcharts have a height of 400px, but this can be customized. You can override the default by specifying either a percentage or a fixed pixel value.

Using a percentage maintains a consistent aspect ratio across different responsive sizes. For example, setting the height to 50% makes the chart’s height half of its width.

Spline


A spline can be added by including a separate chart data with the type: 'spline' attribute.
A color can also be specified for the spline.

Color Overrides


Custom data colors allow for color customization to match the needs of business requirements.
Pass the prop colors and use desired values data-1 | data-2 | data-3 | data-4 | data-5 | data-6 | data-7 | data-8 in an array. Hex colors are also available eg: #CA0095

Stacked


The stacking prop can be used for a stacked bar graph. The prop allows for normal or percent as options.

Negative Numbers


Secondary Y-Axis


Optionally add a second yAxis to support secondary datasets (e.x., a spline) by passing yAxis: 1 to the second node of your chartData array.

To customize the format and/or title of your secondary yAxis, pass your desired values as arrays through the axisFormat and axisTitle props, respectively.

Horizontal Bar Graph


Circle Chart

Default Style


Live Data


Rounded Corners


Accepts Any Block


Color Overrides


Custom data colors allow for color customization to match the needs of business requirements.
Import the colors from Playbook's tokens, then set custom colors in the plotOptions.pie.colors array using the desired color variables. Hex colors are also available eg: #CA0095.

Data Labels


Legend


Legend Position


Prop

align Type: String | Values: left | center | right (defaults to center)
verticalAlign Type: String | Values: top | middle | bottom (defaults to bottom)
layout Type: String | Values: horizontal | vertical | proximate (defaults to horizontal)
x Type: Number (defaults to 0)
y Type: Number (defaults to 0)

layout determines the position of the legend items
layout: proximate will place the legend items as close as possible to the graphs they're representing. It will also determine whether to place the legend above/below or on the side of the plot area, if the legend is in a corner.

x offsets the legend relative to its horizontal alignment. Negative x moves it to the left, positive x moves it to the right

y offsets the legend relative to its vertical alignment. Negative y moves it up, positive y moves it down.

Title


Inner Circle Size Options


Tooltip Customization


Custom tooltip formatting is configured through the tooltip object in the chart options:
headerFormat Type: String | when set to null will disable the header.
pointFormat Type: String | defines the HTML template for each data point and supports custom HTML when useHTML is enabled.
useHTML Type: boolean (default false) | enables HTML rendering in tooltips.
{point.name} and {point.y} are useful values that can be referenced for each point in the graph.

Line Graph

Default


Legend


Legend Position


Prop

align Type: String | Values: left | center | right (defaults to center)
verticalAlign Type: String | Values: top | middle | bottom (defaults to bottom)
layout Type: String | Values: horizontal | vertical | proximate (defaults to horizontal)
x Type: Number (defaults to 0)
y Type: Number (defaults to 0)

layout determines the position of the legend items
layout: proximate will place the legend items as close as possible to the graphs they're representing. It will also determine whether to place the legend above/below or on the side of the plot area, if the legend is in a corner.

x offsets the legend relative to its horizontal alignment. Negative x moves it to the left, positive x moves it to the right

y offsets the legend relative to its vertical alignment. Negative y moves it up, positive y moves it down.

Legend Nonclickable


Height


By default, Highcharts have a height of 400px, but this can be customized. You can override the default by specifying either a percentage or a fixed pixel value.

Using a percentage maintains a consistent aspect ratio across different responsive sizes. For example, setting the height to 50% makes the chart’s height half of its width.

Color Overrides


Custom data colors allow for color customization to match the needs of business requirements.
Import the colors from Playbook's tokens, then set custom colors in the colors array using the desired color variables. Hex colors are also available eg: #CA0095.