-
@create-figma-plugin/build@3.2.1
-
Bumped dependencies in all packages.
-
@create-figma-plugin/build@3.2.0
- Added support for the
documentAccess
,codegenLanguages
,codegenPreferences
andbuild
configuration options.
- Added support for the
-
@create-figma-plugin/common@3.2.0
- Directly copy the
capabilities
,permissions
,networkAccess
,enablePrivatePluginApi
, andenableProposedApi
fields frompackage.json
instead of parsing them by hand.
- Directly copy the
-
@create-figma-plugin/ui@3.2.0
- Fixed type error caused by the
EventHandler
module.
- Fixed type error caused by the
-
Bumped dependencies in all packages.
-
create-figma-plugin@3.1.0
- Updated the
package.json
andtsconfig.json
of theplugin/react-editor
template to use Preact’s types instead of React’s. (#207)
- Updated the
-
Bumped dependencies in all packages.
-
Updated the minimum
node
version tov20
for all packages.
-
create-figma-plugin@3.0.2
- Add missing
titleize
dependency.
- Add missing
-
@create-figma-plugin/build@3.0.2
- Fixed a bug with the
package.json
JSON schema showing a validation error when"menu"
contains multiple separators ("-"
). (#204)
- Fixed a bug with the
Important
Breaking changes to the component APIs may result in TypeScript errors when you build your plugin/widget using the build-figma-plugin
CLI with the --typecheck
flag. You may need to make some code changes if you’re using any of these components: Checkbox
, Dropdown
, IconToggleButton
, Layer
, Modal
, RadioButtons
, RangeSlider
, SearchTextbox
, SegmentedControl
, SelectableItem
, Tabs
, Textbox
, TextboxAutocomplete
, TextboxColor
, TextboxMultiline
, TextboxNumeric
, Toggle
.
If you don’t see any TypeScript errors after upgrading, then your plugin/widget should already be up to date with v3
of Create Figma Plugin.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop. - Changed the type of the
value
prop tonull | string
. - Removed the
Value
type parameter fromDropdownOption
. - Changed
DropdownOptionSeparator
from{ separator: true }
to"-"
.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop.
- Removed the
noTransition
prop in favor of setting the newtransition
prop tofalse
.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop. - Changed the type of the
value
prop tonull | string
. - Removed the
Value
type parameter fromRadioButtonsOption
.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueInput
andonNumericValueInput
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueInput
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop. - Changed the type of the
value
prop tonull | string
. - Removed the
Value
type parameter fromSegmentedControlOption
.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueInput
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueInput
function prop. - Changed
TextboxAutocompleteOptionSeparator
from{ separator: true }
to"-"
.
- Removed the
hexColorName
andopacityName
props. - Removed the second
name
parameter from theonHexColorValueInput
,onOpacityNumericValueInput
,onOpacityValueInput
, andonRgbaColorValueInput
function props.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueInput
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueInput
andonNumericValueInput
function prop.
- Removed the
name
prop. - Removed the second
name
parameter from theonValueChange
function prop.
- Bumped dependencies in all packages.
- Fixed the dynamic importing of
build-figma-plugin.*.js
files. Using theexport default
syntax (instead ofmodule.exports =
) is supported only if"type": "module"
is specified in thepackage.json
file. (#197) - Fixed a bug with having both a
codegen
command and menu commands in a Dev Mode plugin. (#202) - Refined the
package.json
JSON schema for"editorType"
,"menu"
,"parameters"
,"capabilities"
,"permissions"
, and"networkAccess"
.
- Disable scrolling when the
grow
prop is set inTextboxMultiline
. Dropdown
:- Added support for setting a
ref
prop in all components. - Stop importing Inter from Google Fonts in favor of using the version of Inter already loaded in the Figma editor. (#188)
- Changed the behavior of
Textbox
,TextboxAutocomplete
,TextboxColor
,TextboxMultiline
, andTextboxNumeric
to not blur on pressing theEnter
key. (#192) - Stop the menu in
Dropdown
andTextboxAutocomplete
from appearing on focus. (#193) - Hide the menu in
Dropdown
andTextboxAutocomplete
when the page is scrolled.
-
create-figma-plugin@2.6.1
- Added dark mode support to the
plugin/preact-tailwindcss
template. (#174)
- Added dark mode support to the
-
@create-figma-plugin/build@2.6.1
- Preserve backslashes in inserted class names. (#174)
-
@create-figma-plugin/utilities@2.6.1
- Check argument shape in
src/events.ts
to allow other code to usefigma.ui.postMessage
andwindow.parent.postMessage
. (#180)
- Check argument shape in
-
create-figma-plugin@2.6.0
- Fixed a bug with bootstrapped plugins/widgets not including a
.gitignore
. (#173) - Added a new
plugin/preact-tailwindcss
template. - Bumped the
@figma/plugin-typings
version.
- Fixed a bug with bootstrapped plugins/widgets not including a
-
@create-figma-plugin/build@2.6.0
- Added support for customizing the output directory via the
--output
CLI flag. (#157, #170) - Added support for configuring
networkAccess
. (#164) - Updated the options for
capabilities
(addedcodegen
andinspect
) andpermissions
(addedfileusers
,payments
andteamlibrary
). (#169) - Improved the handling of new and deleted files when using the
--watch
flag. - Additional keys configured under
"figma-plugin"
inpackage.json
will be copied over to the generatedmanifest.json
file.
- Added support for customizing the output directory via the
-
@create-figma-plugin/ui@2.6.0
- Exposed CSS files via
exports
in the module’spackage.json
file. (#171)
- Exposed CSS files via
-
create-figma-plugin@2.5.1
- Update
@figma/plugin-typings
version to1.69.0
.
- Update
-
@create-figma-plugin/ui@2.5.0
- Fixed a bug in the
Dropdown
component where the current menu element is highlighted onmousedown
. - Filtered out non-focusable elements (
tabindex="-1"
) in theuseInitialFocus
hook. - Removed whitespace above and below the
RangeSlider
component.
- Fixed a bug in the
-
Bumped dependencies in all packages.
-
@create-figma-plugin/build@2.4.0
-
@create-figma-plugin/utilities@2.4.0
- Fixed a bug with
getDocumentComponents
not returning nested components (#153)
- Fixed a bug with
-
@create-figma-plugin/utilities@2.3.0
- Added utilities for image handling:
createCanvasElementFromBlobAsync
createCanvasElementFromBytesAsync
createCanvasElementFromImageElement
createImageElementFromBlobAsync
createImageElementFromBytesAsync
readBytesFromCanvasElementAsync
- Added utilities for image handling:
-
@create-figma-plugin/build@2.2.0
-
@create-figma-plugin/ui@2.2.0
- Renamed all CSS files to have a
.module.css
prefix. - Switched to using Vite to build the Storybook.
- Renamed all CSS files to have a
-
create-figma-plugin@2.2.0
- Pinned to
preact@>=10
andtypescript@>=4
in all plugin and widget templates.
- Pinned to
-
Bumped dependencies in all packages.
-
Replaced
lerna
with@lerna-lite/cli
andturbo
. -
Replaced
ts-node
withtsx
. -
Refactored all
npm
scripts
. -
Changed the minimum
node
version tov18
for all packages.
-
@create-figma-plugin/ui@2.1.6
- Added padding to the
Textbox
,TextboxAutocomplete
,TextboxMultiline
andTextboxNumeric
components to prevent overflowing text from being clipped. (#136)
- Added padding to the
-
@create-figma-plugin/utilities@2.1.6
-
@create-figma-plugin/ui@2.1.5
- Limited the hit area of the
Disclosure
component to the title. (#128)
- Limited the hit area of the
-
@create-figma-plugin/build@2.1.4
- Suppressed the
Cannot redeclare block-scoped variable 'console'.
type-check error when using@types/node
. (#126)
- Suppressed the
-
create-figma-plugin@2.1.4
- Removed unnecessary imports in the
plugin/react-editor
template. (#126)
- Removed unnecessary imports in the
-
Bumped dependencies in all packages, and removed usage of
untyped-dependencies.d.ts
.
-
@create-figma-plugin/build@2.1.3
- Made the
build-figma-plugin
CLI pick up changes inbuild-figma-plugin.(main|ui|manifest).json
configuration files during--watch
. (#119)
- Made the
-
create-figma-plugin@2.1.3
- Updated the
create-figma-plugin
CLI terminal output to include commands for getting started. - Fixed usage of components from
@create-figma-plugin/ui@2
(eg. removed use of themuted
prop in theText
component). - Prettified all templates.
- Updated the
-
Bumped dependencies in all packages.
-
@create-figma-plugin/ui@2.1.2
- Added
color-scheme: dark;
to dark mode base CSS.
- Added
-
create-figma-plugin@2.1.2
- Bumped
@figma/plugin-typings
and@figma/widget-typings
versions.
- Bumped
-
@create-figma-plugin/ui@2.1.1
-
@create-figma-plugin/ui@2.1.0
- Added a
RangeSlider
component. - Added left and right padding to the
underline
variant ofDropdown
,Textbox
,TextboxAutocomplete
,TextboxColor
, andTextboxNumeric
. - Added missing styles for the
underline
variant ofTextboxMultiline
.
- Added a
-
Bumped dependencies in all packages.
-
create-figma-plugin@2.0.1
- Fix usage of the
Container
component in theplugin/preact-rectangles
andplugin/react-editor
templates. - Bump dependencies in the
plugin/react-editor
template.
- Fix usage of the
-
Replaced
yarn@1
withnpm@8
for local development. -
Bumped dependencies in all packages.
- All CSS color variables (ie. variables with a
--color
prefix) have been removed. Use Figma’s official color tokens to style your custom components.- To migrate, do a search for
--color
in your CSS and replace these variables with an appropriate color token (ie. variables with a--figma-color
prefix).
- To migrate, do a search for
- All components now utilize Figma’s color tokens, and support dark mode out of the box. (#99)
- Renamed the
type
prop tovariant
.- Use
variant="success"
to render a green banner.
- Use
- Renamed the
destructive
prop todanger
.
- The
space
prop is now required rather than optional.
- Renamed the
isOpen
prop toopen
.
- Removed the
noBorder
prop. The default behavior is to not show a gray border in the passive state. - Added a
variant
prop (string
; optional).- Use
variant="border"
to show a gray border in the passive state. - Use
variant="underline"
to show a gray border only on the bottom side in the passive state.
- Use
- Fixed a bug with
Dropdown
not truncating when embedded within aflex
parent. (#101) - Skip validation of clipboard content when
strict
isfalse
inTextboxAutocomplete
. (#107)
- The
color
prop must be a specific Figma color token.
- This is a new, non-toggleable version of the
IconToggleButton
component. (#102)
- This component was renamed from
IconButton
.
- The focus state now shows a border.
- Removed the
color
prop. - Added a
component
prop (boolean
; optional) for rendering a component layer (ie. purple icon and text). - Made the
icon
prop mandatory. - Renamed the
pageName
prop todescription
.
- The focus state now shows a border.
- Removed the
bold
andmuted
props.- Styling inline text should be done via the new inline text components
Bold
,Code
,Link
, andMuted
.
- Styling inline text should be done via the new inline text components
- Added a
children
prop (ComponentChildren
; mandatory).
-
showUI
now takes athemeColors
option (boolean
; optional), which defaults totrue
. (themeColors
must be set totrue
if you’re using the components in@create-figma-plugin/ui
.) -
Fixed a compilation problem caused by missing
.js
extensions in the import statements inset-relaunch-button.ts
andunset-relaunch-button.ts
. (#109)
-
@create-figma-plugin/ui@1.9.2
- Fixed a bug with the
Dropdown
menu not re-calculating its height whenvalue
isnull
. (#100)
- Fixed a bug with the
-
@create-figma-plugin/ui@1.9.1
- Reverted to
css-loader@5.2.7
andstyle-loader@2.0.0
.
- Reverted to
-
Reverted to
cpy-cli@3.1.1
.
-
@create-figma-plugin/build@1.9.0
-
@create-figma-plugin/ui@1.9.0
- Fixed a bug with scrollbars appearing in the
Dropdown
component. (#97) - Added a
noTransition
prop to theModal
component.
- Fixed a bug with scrollbars appearing in the
-
Bumped dependencies in all packages
- Used
ava@4
, which required replacingtsm
withts-node
. - Pinned to
typescript@4.4.4
.
- Used
-
@create-figma-plugin/build@1.8.4
- Resolved paths to
tcm
andpreact-compat
starting from__dirname
so thatbuild-figma-plugin
will work when used in apnpm
monorepo. (#84)
- Resolved paths to
-
@create-figma-plugin/ui@1.8.3
- Fixed a bug with the
Modal
component incorrectly trapping focus on the first input it contains on subsequent renders. (#80)
- Fixed a bug with the
-
@create-figma-plugin/utilities@1.8.3
- Added a
ensureMinimumTime
utility. - Prevent modification of
defaultSettings
inloadSettingsAsync
. (#79)
- Added a
-
Bumped dependencies in all packages.
- Revamped the documentation website.
- Bumped dependencies in all packages.
-
create-figma-plugin@1.8.1
- Fixed a bug to include the
.gitignore
file when bootstrapping from a template. (#76)
- Fixed a bug to include the
-
@create-figma-plugin/utilities@1.8.0
- Added
isLocked
andisVisible
utilities. (#75)
- Added
-
Added a recipe for disabling the automatic swapping of React imports using a
build-figma-plugin.ui.js
file.
-
@create-figma-plugin/build@1.7.3
- Allow
parameterOnly
to be set tofalse
. (#74)
- Allow
-
@create-figma-plugin/build@1.7.2
- Suppressed TypeScript error that occurs when the type definition of an imported package contains
<reference types="node" />
. (#71)
- Suppressed TypeScript error that occurs when the type definition of an imported package contains
-
@create-figma-plugin/utilities@1.7.2
computeBoundingBox
– Accounted forCodeBlock
node which does not have arotation
property.
-
Bumped dependencies in all packages.
-
Replaced
ts-node
withtsm
. -
Use
stylelint-config-idiomatic-order
instead ofstylelint-config-rational-order
(viastylelint-config-yuanqing
).
- Documentation updates.
-
@create-figma-plugin/build@1.7.0
- Added support for building FigJam widgets.
- Added new configuration options
widgetApi
,containsWidget
, andpermissions
.
- Added new configuration options
- Renamed the
apiVersion
configuration option toapi
, to be aligned with the pluginmanifest.json
API.
- Added support for building FigJam widgets.
-
@create-figma-plugin/ui@1.7.0
-
create-figma-plugin@1.7.0
- Refactored the
create-figma-plugin
CLI; a template can now be selected via an interactive interface. - Added a
widget/notepad
template, and reorganized existing templates.
- Refactored the
-
Documentation updates.
-
@create-figma-plugin/ui@1.6.2
- Fixed positioning logic in the
Modal
component.
- Fixed positioning logic in the
-
@create-figma-plugin/utilities@1.6.2
- Added
traverseNodeAsync
.
- Added
- Documentation updates.
-
@create-figma-plugin/build@1.6.0
- Made
build-figma-plugin --watch
aware of changes tobuild-figma-plugin.*.js
files.
- Made
-
@create-figma-plugin/ui@1.6.0
- Added a
Modal
component. (#47) - Added new components
Disclosure
,IconChevronDown32
,IconChevronLeft32
IconChevronRight32
, andIconChevronUp32
. - Regenerated all icon components.
- Added a
useWindowResize
hook. (#59) - Added a call to
useEffect
in theuseFocusTrap
hook. - Added CSS variables
--box-shadow-menu
,--box-shadow-modal
, and--font-family-code
. - Made
computeBoundingBox
compatible with@figma/plugin-typings@1.37.0
.
- Added a
-
create-figma-plugin@1.6.0
- Renamed the
ui
template topreact-rectangles
. - Added new templates
preact-resizable
andreact-editor
. - Updated the
@figma/plugin-typings
version to1.37.0
.
- Renamed the
-
Bumped dependencies in all packages.
-
@create-figma-plugin/utilities@1.5.1
- Moved constants
MIXED_NUMBER
andMIXED_STRING
from@create-figma-plugin/ui
to@create-figma-plugin/utilities
.
- Moved constants
-
@create-figma-plugin/build@1.5.0
- Restart the TypeScript watcher when changes are made to
tsconfig.json
. (#56) - Enabled usage of React components by swapping out
react
andreact-dom
imports withpreact/compat
. - Added the ability to import “global” CSS by adding a
!
prefix before the CSS file path. (#60) - Accounted for the case where
figma.command
isundefined
(eg. in a FigJam widget).
- Restart the TypeScript watcher when changes are made to
-
@create-figma-plugin/utilities@1.5.0
- Added support for FigJam nodes in
loadFontsAsync
. (#57)
- Added support for FigJam nodes in
-
Improved documentation.
-
@create-figma-plugin/build@1.4.0
- Suppressed the
Cannot redeclare block-scoped variable 'console'.
type-check error when using@figma/plugin-typings@^1.32.0
. (#54) - Added an escape hatch for modifying the
manifest.json
file just before it gets written to disk.
- Suppressed the
-
@create-figma-plugin/utilities@1.4.0
computeBoundingBox
– Accounted for FigJam-specific nodes (eg.Connector
,Sticky
) which do not have arotation
property.
-
create-figma-plugin@1.4.0
- Removed the
--yes
flag and the ability to customize the display name. - Removed the CLI interactive prompt.
- Updated the plugin installation instructions in all templates.
- Removed the
-
Bumped dependencies in all packages.
-
create-figma-plugin@1.3.4
- Pinned to a specific version of
@figma/plugin-typings
in all plugin templates.
- Pinned to a specific version of
-
@create-figma-plugin/utilities@1.3.4
- Returned
variant
data invalidateGumroadLicenseKeyMainAsync
andvalidateGumroadLicenseKeyUiAsync
.
- Returned
- Added docs for
editorType
.
-
@create-figma-plugin/build@1.3.2
- Fixed the building of CSS Module typings in Windows. (#51)
-
Improved documentation.
-
@create-figma-plugin/build@1.3.1
- Updated the configuration JSON schema.
-
@create-figma-plugin/utilities@1.3.1
- Added
deduplicateArray
.
- Added
-
Added docs for
parameters
andparameterOnly
.
-
@create-figma-plugin/build@1.3.0
- Added support for the new
editorType
,parameters
andparameterOnly
config.
- Added support for the new
-
@create-figma-plugin/monetization@1.3.0
- This package is deprecated; all monetization-related utility functions have been moved into
@create-figma-plugin/utilities
.
- This package is deprecated; all monetization-related utility functions have been moved into
-
@create-figma-plugin/build@1.2.4
- Fixed a bug with the
build-figma-plugin
CLI throwing an error when the current working directory absolute path contains spaces. (#49)
- Fixed a bug with the
-
@create-figma-plugin/build@1.2.3
- Fixed a bug with how CSS file paths are resolved. (#48)
- Added a recipe for using image assets in the plugin UI. (#45)
-
create-figma-plugin@1.2.1
- Added a
ui
template. - Simplified the CLI; now, only a
name
,displayName
andtemplate
are necessary. - Fixed a bug with CLI arguments parsing. (#41)
- Added a
-
Added a recipe for customizing the underlying esbuild configuration.
-
@create-figma-plugin/build@1.2.0
- Added the ability to override the esbuild configuration for the main bundle (via a
build-figma-plugin.main.js
file) and the UI bundle (via abuild-figma-plugin.ui.js
file). (#34) - Improved the UX of the
build-figma-plugin --watch --typecheck
terminal output. (#38)- Fixed a bug with watch mode terminating on error. (#40)
- Added the ability to override the esbuild configuration for the main bundle (via a
-
@create-figma-plugin/monetization@1.2.0
- This is a new package that includes utilities for:
- Tracking the number of plugin runs.
- Verifying a Gumroad license key.
- This is a new package that includes utilities for:
-
@create-figma-plugin/ui@1.2.0
- New features:
- Added
Banner
andIconButton
components. - Added a
validateOnBlur
prop toTextbox
,TextboxNumeric
, andTextboxMultiline
.
- Added
- Bug fixes:
- Allow pressing
Tab
to hide the menu in theDropdown
component. - Fixed a bug for when the
suffix
prop is specified inTextboxNumeric
. - Fixed UI bugs in the
useFocusTrap
anduseScrollableMenu
hooks. - Middle-aligned the
icon
relative to the height of the textbox in theTextbox
,TextboxAutocomplete
,TextboxNumeric
components. - Adjusted the focused style (the height of the blue outlined box) and the selected style (the background color of the selected text) of all textboxes (ie.
Textbox
etc.) to be identical to that in the Figma editor. - Prevent menu items in
Dropdown
andTextboxAutocomplete
from wrapping. - Dynamically adjust the horizontal menu position of
Dropdown
. (#37)
- Allow pressing
- CSS:
- Added colors
--color-black-6-translucent
,--color-black-3-translucent
, and--color-blue-30-translucent
to@create-figma-plugin/ui/lib/css/base.css
.
- Added colors
- New features:
-
@create-figma-plugin/utilities@1.2.0
- New features:
convertHexColorToRgbColor
convertNamedColorToHexColor
convertRgbColorToHexColor
isValidHexColor
unsetRelaunchButton
- Bug fixes:
- When
setRelaunchButton
is called, any relaunch buttons (with a differentrelaunchButtonId
) previously set by the plugin on the particular node will be retained rather than overriden.
- When
- New features:
-
@create-figma-plugin/ui@1.1.1
- New features:
TextboxColor
– Added a new component for receiving a user input hex color with opacity.Dropdown
,TextboxAutocomplete
– Allow individual menu options to bedisabled
.SearchTextbox
,Textbox
,TextboxAutocomplete
,TextboxMultiline
,TextboxNumeric
– Added aspellCheck
prop that defaults tofalse
to hide the red squiggly lines from the browser’s spellchecking.
- Bug fixes:
Dropdown
,TextboxAutocomplete
– Fixed az-index
bug with the menu, hide the menu on clicking anywhere outside the pluginiframe
(previously the menu only hides when clicking outside the menu but within the pluginiframe
).TextboxNumeric
– Fixed a bug withrevertOnEscapeKeyDown
not working as expected when thesuffix
prop is also set.Dropdown
– Fixed dynamic positioning of the menu.Button
,SearchTextbox
,Textbox
,TextboxAutocomplete
,TextboxMultiline
,TextboxNumeric
– Set thebackground-color
of the root element totransparent
.
- New features:
-
create-figma-plugin@1.0.2
- Added
src/**/*.tsx
to the"include"
key of thedefault
template’stsconfig.json
.
- Added
-
@create-figma-plugin/ui@1.0.1
- Made the
--box-shadow
style identical to that in the Figma CSS. - Fixed the style of disabled options in the
SegmentedControl
component.
- Made the
-
create-figma-plugin@1.0.1
- Included
plugin-templates/*/.gitignore
in the published package. - Added a
^
prefix to@create-figma-plugin/*
version numbers in thedefault
template.
- Included
-
Improved documentation.
Note: 1.0.0 requires Node.js v14.
@create-figma-plugin/build@1.0.0
@create-figma-plugin/tsconfig@1.0.0
@create-figma-plugin/ui@1.0.0
@create-figma-plugin/utilities@1.0.0
-
The
build-figma-plugin
CLI is now powered by esbuild, replacing Webpack. esbuild is extremely fast, and building any non-trivial plugin should reliably take less than 1 second. (esbuild actually runs within a couple hundred milliseconds, but some parts of the build process – compiling and generating.d.ts
files for CSS modules, generating themanifest.json
file – still runs in Node.js-land.) -
Given the move away from Webpack, the ability to override the build process via a
figma-plugin.config.js
file has also been removed. -
Minification and typechecking of your plugin code is now disabled by default in the
build-figma-plugin
CLI. Thebuild
andwatch
scripts in yourpackage.json
should be updated as follows:{ ... "scripts": { - "build": "build-figma-plugin", + "build": "build-figma-plugin --typecheck --minify", - "watch": "build-figma-plugin --watch", + "watch": "build-figma-plugin --typecheck --watch", ... }, ... }
-
The ability to use SCSS in CSS Modules has been removed. Now, only “vanilla” CSS Modules is supported. To migrate, use the
sass
CLI to do a one-off conversion of your.scss
files to.css
, then update your UI code to reference the generated.css
files. -
There’s now a JSON schema for validating the plugin configuration in your
package.json
file. To enable autocomplete and inline validation of your plugin configuration in Visual Studio Code, create a.vscode/settings.json
file containing the following:{ "json.schemas": [ { "fileMatch": [ "package.json" ], "url": "https://yuanqing.github.io/create-figma-plugin/figma-plugin.json" } ] }
-
The
tsconfig.json
file has changed significantly, given the move to esbuild.{ "compilerOptions": { "esModuleInterop": true, "isolatedModules": true, "jsx": "react", "jsxFactory": "h", "lib": ["DOM", "ES2020"], "module": "ES2020", "moduleResolution": "Node", "strict": true } }
-
Either copy the above to your project’s
tsconfig.json
, or directly extend from@create-figma-plugin/tsconfig
. You should at least ensure that the"isolatedModules"
option is enabled in yourtsconfig.json
.
-
There are many breaking changes and new features. Your best bet for migrating to
v1
might be to try to build your plugin using thebuild-figma-plugin --typecheck --watch
command, and then incrementally fixing the errors surfaced by the TypeScript compiler. Otherwise, refer to usage examples of all the components in the Storybook, or see below for a detailed breakdown of all component changes. -
One of the most significant changes is that the
onChange
prop of all components now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. See the before and after, using theCheckbox
component as an example:// Before `v1` const [state, setState] = useState({ foo: false }) // ... <Checkbox name="foo" onChange={setState} value={state.foo}> Text </Checkbox>
// `v1` const [value, setValue] = useState(false) function handleChange(event: JSX.TargetedEvent<HTMLInputElement>) { const newValue = event.currentTarget.checked console.log(newValue) //=> either `true` or `false` setValue(newValue) } // ... <Checkbox onChange={handleChange} value={value}> Text </Checkbox>
-
An alternative to using the
onChange
prop to listen to state changes is to use the newonValueChange
prop. This prop is available on all components that also have anonChange
prop. TheonValueChange
handler has the signature<Value, Name extends string>(newValue: Value, name?: Name) => void
, and it is called on every DOMchange
event. The secondname
parameter passed to the handler is precisely thename
prop that was set on the component. Again, using theCheckbox
component as an example:const [value, setValue] = useState(false) function handleChange(newValue: boolean, name: undefined | string) { console.log(newValue) //=> either `true` or `false` console.log(name) //=> 'foo' setValue(newValue) } // ... <Checkbox name="foo" onValueChange={handleValueChange} value={value}> Text </Checkbox>
-
The
onChange
prop has been removed from theSearchTextbox
,Textbox
,TextboxAutocomplete
, andTextboxNumeric
components. (This prop was inaccurately named for these components because the handler is actually called on every DOMinput
event.) Instead, use theonInput
andonValueInput
props to handle the DOMinput
event. -
The
DropdownMenu
component has been removed. Use the newDropdown
component, which has an improved UI design and component API. -
All component styles are now written as “vanilla” CSS modules rather than SCSS. The previous SCSS variables are now expressed as CSS variables on
:root
. Refer to thebase.css
file in@create-figma-plugin/ui
for the list of CSS variables that are available for use in your custom CSS. -
Added new components
Dropdown
,MiddleAlign
,TextboxMultiline
andToggle
, in addition to 175 icon components extracted from Figma’s official “UI2” design system file on Figma Community.
-
All icons are now exported as Preact functional components. Refer to the following mapping to migrate existing icons to their equivalents in
v1
:checkCircleIcon
→<IconCheckCircle32 />
checkIcon
→<IconMenuCheckmarkChecked16 />
componentIcon
→<IconLayerComponent16 />
crossIcon
→<IconCross32 />
frameIcon
→<IconLayerFrame16 />
imageIcon
→<IconLayerImage16 />
moveDownIcon
→<IconMoveDown16 />
moveRightIcon
→<IconMoveRight16 />
searchIcon
→<IconSearch32 />
spaceHorizontalIcon
→<IconSpacingHorizontal16 />
spaceVerticalIcon
→<IconSpacingVertical16 />
Note that
IconCheckCircle32
,IconCross32
andIconSearch32
all have a dimension of32px
, which is double the size of the corresponding icons in versions of@create-figma-plugin/ui
prior tov1
. -
All icons also now take a
color
prop for customizing thefill
colour of the iconsvg
.
- The
focused
prop has been removed.
- The
focused
prop has been removed. - The
onChange
prop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueChange
prop with the signature(newValue: boolean, name?: string) => void
.
- The
focused
andonClick
props have been removed. - The
onSelectedFiles
prop now has the signature(files: Array<File>) => void
.
- The
onSelectedFiles
prop now has the signature(files: Array<File>) => void
.
- This component has an almost entirely new API. (The
onClick
,selected
, andtype
props have been removed. New props includebold
,onChange
,onValueChange
,icon
,color
, andvalue
.)
- There’s a new
color
prop for customizing thefill
colour of thesvg
representing the loading indicator.
- The
value
prop can now benull
, or aboolean
,number
, orstring
. - The
focused
prop has been removed. - The
onChange
prop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueChange
prop with the signature(newValue: boolean | number | string, name?: string) => void
. - For the
RadioButtonsOption
type:- The
text
key has been renamed tochildren
. value
can now only be aboolean
,number
, orstring
.
- The
- The
focused
andonChange
props have been removed. - There’s a new
onInput
prop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueInput
prop with the signature(newValue: string, name?: string) => void
.
- The height of the component is now
24px
(reduced from36px
) to be identical to the height of segmented controls in the Figma editor UI. - The style of the component’s focused state has been tweaked to follow that of segmented controls in the Figma editor UI.
- The
value
prop cannot benull
and can now only be aboolean
,number
, orstring
. - The
focused
prop has been removed. - The
onChange
prop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueChange
prop with the signature(newValue: boolean | number | string, name?: string) => void
. - In the
SegmentedControlOption
type:- The
text
key has been renamed tochildren
. value
cannot benull
and can now only be aboolean
,number
, orstring
.
- The
- The
onKeyDown
prop has been removed. - The
onChange
prop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueChange
prop with the signature(newValue: boolean, name?: string) => void
.
- The
focused
prop has been removed. - The
onChange
prop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueChange
prop with the signature(newValue: string, name?: string) => void
. - In the
TabsOption
type:- The
disabled
andtext
keys have been removed. - The
view
key has been renamed tochildren
. value
can now only be astring
.
- The
- The height of the component is now
28px
(reduced from32px
) to be identical to the height of textboxes in the Figma editor UI. - The
value
prop cannot benull
and can now only be astring
.- A “Mixed” value is represented by the
MIXED_STRING
constant from@create-figma-plugin/utilities
.
- A “Mixed” value is represented by the
- The
focused
,onChange
, andtype
props have been removed. - There’s a new
onInput
prop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueInput
prop with the signature(newValue: string, name?: string) => void
. - There’s a new
password
prop for changing the display to a password field. (Previously, you’d set thetype
prop to'password'
.) - There’s a new
revertOnEscapeKeyDown
prop to enable reverting the originalvalue
when theEsc
key is pressed.
- The height of the component is now
28px
(reduced from32px
) to be identical to the height of textboxes in the Figma editor UI. - The height of the autocomplete menu will dynamically expand (while still keeping within the dimensions of
window
) so as to fit as many items as possible in the menu. - The
focused
andonChange
props have been removed. - There’s a new
onInput
prop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueInput
prop with the signature(newValue: string, name?: string) => void
. - There’s a new
revertOnEscapeKeyDown
prop to enable reverting the originalvalue
when theEsc
key is pressed.
- The height of the component is now
28px
(reduced from32px
) to be identical to the height of textboxes in the Figma editor UI. - The
value
prop cannot benull
and can now only be astring
.- A “Mixed” value is represented by the
MIXED_STRING
constant from@create-figma-plugin/utilities
.
- A “Mixed” value is represented by the
- The
focused
, andonChange
props have been removed. - There’s a new
onInput
prop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void
. - There’s a new
onValueInput
prop with the signature(newValue: string, name?: string) => void
. - There’s a new
onNumericValueInput
prop with the signature(newValue: null | number, name?: string) => void
, wherenewValue
is the result of evaluatingvalue
as a numeric expression.- If
value
is the empty string, thennewValue
is null. - If
value
is theMIXED_STRING
constant from@create-figma-plugin/utilities
, thennewValue
will be theMIXED_NUMBER
constant from the same.
- If
- There’s a new
revertOnEscapeKeyDown
prop to enable reverting the originalvalue
when theEsc
key is pressed. - There’s a new
suffix
prop for automatically appending an arbitrary string to the numeric textbox.
compareArrays
has been removed. UsecompareObjects
instead.isWithinInstance
has been renamed toisWithinInstanceNode
.computeSiblingNodes
,deduplicateNodes
,sortNodesByCanonicalOrder
, andsortNodesByName
all now take a type parameter<Node extends SceneNode>
. This type parameter allows these functions to accept and return arrays of specific node types, rather than merely an array ofSceneNode
.loadSettingsAsync
andsaveSettingsAsync
both now take an optional second argument for customizing the key for loading from or saving tofigma.clientStorage
.- Added new utilities
compareStringArrays
,getParentNode
, andgetSceneNodeById
.