React Figma UI
React implementation for figma-plugin-ds by Tom Lowry
How to Install
First, install the library in your project by npm:
Or Yarn:
Components
Button
To use the button, use the following component. Each button has a destructive option. Tertiary buttons are styled like hyperlinks.
Available options
HTML button element props and dedicated params
Param | Description |
---|---|
tint |
Display style for button: primary (filled), secondary (outlined), tertiary (hyperlink) |
destructive |
Add red destructive variant for actions such as deleting something |
Checkbox
To use the checkbox, use the following component. Remember each checkbox should get a unique ID.
Available options
HTML input element props and dedicated params
Param | Description |
---|---|
containerProps |
Props for checkbox container |
labelProps |
Props for label element |
Disclosure
To use a disclosure panel, you must use the following component.
Available options
Disclosure
HTML ul element props and dedicated params
Param | Description |
---|---|
tips |
Array with disclosure tips |
render |
Render props for DisclosureTip |
DisclosureTip
HTML li element props and dedicated params
Param | Description |
---|---|
heading |
Heading text value |
content |
Content text value |
section |
Style label like a heading |
expanded |
Add this option to have item expanded on load |
labelProps |
Props for label element |
contentProps |
Props for content element |
Icon
To use the icon, use the following component. Apply the appropriate icon name to select the item you wish to use, you can also add option to change the color, or even spin the icon. You can also specify no icon name to use a text character as an icon (for example, like found in the width + height icon inputs in Figma)
Available options
HTML div element props and dedicated params
Param | Description |
---|---|
iconName |
Sepcify which icon to use (e.g.: alert , draft , settings ) |
spin |
Causes the icon to spin in an endless loop (e.g.: loader used with spinner icon) |
colorName * |
Pass the name of any Figma color var to this prop (e.g.: blue , black3 ) |
*Colors accepted: blue
, purple
, purple4
, hot-pink
, green
, red
, yellow
, black
, black8
, black3
, white
, white8
, white4
Icon button
The icon button is essentially a wrapper for the icon component.
Available options
HTML div element props and dedicated params
Param | Description |
---|---|
selected |
Add this option to have selected style for button |
iconProps |
Props for icon component |
Input
To use the input, use the following component.
Available options
HTML input element props and dedicated params
Param | Description |
---|---|
containerProps |
Props for switch container |
iconProps |
Props for icon component |
Labels and sections
To use a label or section, use following components.
Available options
Onboarding tip
To create an onboarding tip, use the following component.
Available options
HTML div element props and dedicated params
Param | Description |
---|---|
containerProps |
Props for switch container |
iconProps |
Props for icon component |
Radio button
To create an radio button, use the following component. Remember each group of radio buttons must share the same name so that they are related to one another. Each button should have a unique id so that its label is associated with it and remains part of the clickable hit area.
Available options
HTML input element props and dedicated params
Param | Description |
---|---|
containerProps |
Props for radio container |
labelProps |
Props for label element |
Select menu
To create an select menu, use following components.
The select menu will open and position the menu to the selected object. If there is no vertical room inside your plugin's iFrame, the position of the menu will be moved to ensure it fits inside the iframe. If you have a select menu with too many options to fit within the iFrame, the menu will scroll vertically.
Available options
SelectMenu
HTML select element props and dedicated params
Param | Description |
---|---|
options |
Array with select menu options |
render |
Render props for SelectMenuOption |
SelectMenuOption
Switch
To use the switch, use the following component. Remember each switch should get a unique ID that is referenced in the label. This ensures the switch and the entire label are clickable.
Available options
HTML input element props and dedicated params
Param | Description |
---|---|
containerProps |
Props for switch container |
labelProps |
Props for label element |
Textarea
To use the textarea, use the following component.
Available options
Type
To use the typography that is styled like it is in the Figma UI, use the following component plus additional options to modify the size, weight, and letterspacing that is optimized for positive (dark text on light background) and negative (light text on dark background) applications.
Available options
HTML div element props and dedicated params
Param | Description |
---|---|
size |
Font size: small - 12px, large - 13px, xlarge - 14px |
weight |
Font weight: medium, bold |
inverse |
Inversed (negative) application where light text is on dark background with increased letterspacing |
Defaults: Font size 11px, normal weight, positive application
License
This project is licensed under the MIT License © 2020-present Jakub Biesiada