UI
A set of UI elements to build CARTO for React applications.
The package includes 2 main elements: a set of values to use a Material UI theme with CARTO brand (cartoThemeOptions
) + a group of widgets:
CategoryWidgetUI
: to display with horizontal bars a magnitude for each selected category (eg. population sum per country).FeatureSelectionWidgetUI
: to specify a shape and use it to filter features spatially.FormulaWidgetUI
: to represent a single value (eg. average income in $).HistogramWidgetUI
: to display the distribution of values, with arbitrary bins (eg. number of stores per annual income).LegendWidgetUI
: to provide layer switching functionality and display legends for layers.PieWidgetUI
: to represent structure, using also ‘category’ groups, this time displayed with a donut chart.ScatterPlotWidgetUI
: to visualize the correlation between two different fields from a dataset.TableWidgetUI
: to show feature column values in a tabular view.TimeSeriesWidgetUI
: to visualize the evolution through time of features containing a column with timestamp values.WrapperWidgetUI
: a collapsible panel with a title, useful to wrap other UI elements.
This package, @carto/react-ui
contains the user interface components for the widgets and the @carto/react-widgets
package contains the widgets business logic. The UI is decoupled from the business logic so you can provide your own user interface or modify the business logic.
To get information about the different properties available for each of the widgets, please access our Storybook catalogue, an interactive tool for documenting our Material UI theme and the additional components we have built.
Constants & enums
cartoThemeOptions
A tree of configuration elements (colors, font sizes, families…) to define a theme. See official doc on theming at Material UI theming
Example for v1.5 (MaterialUI 4)
From v2.x, not just the cartoThemeOptions object is exported, but the fully created theme, including our recommended set up for responsive mode. I means that using it, without customization should be as easy as this
Example for v1.5 (MUI 5)
LEGEND_TYPES
Constants for the different legend types available.
Options:
CATEGORY
. Use this type when you are visualizing a choropleth map based on the value of astring
property.ICON
. Use this type when you are visualizing a point layer using icons.CONTINUOUS_RAMP
. Use this type when you are visualizing a layer using a continuous color ramp based on a numeric property.BINS
. Use this type when you are visualizing a layer assigning colors to bins/intervals based on a numeric property.PROPORTION
. Use this type when you are visualizing a point layer using proportional symbols (size-varying).CUSTOM
. Use this type when you have a custom visualization that does not fit with the other legend types. It allows you to provide your own legend component.
Example:
Last updated