⚛️ A React renderer for Figma
An example:
<Page name="New page" style={{ backgroundColor: '#ff0000' }}>
<View>
<View style={{ width: 200, height: 100, backgroundColor: '#ffffff' }} />
</View>
</Page>
Add useStyleByKey hook which allows one to pass in specific textStyleId, fillStyleId, etc.
const ViewComponent = () => {
const fillStyle = useStyleByKey('testStyleId');
return (
<View
style={{
fillStyleId: fillStyle && fillStyle.id
}}
/>
);
};
const TextComponent = () => {
const textStyle = useStyleByKey('testStyleId');
return (
<Text
style={{
textStyleId: textStyle && textStyle.id
}}
/>
);
};
Args | Type | Default | Note |
---|---|---|---|
style.blurType |
LAYER_BLUR or BACKGROUND_BLUR |
LAYER_BLUR |
Type of blur effect |
style.blurRadius |
number |
0 |
Blur radius. Must be >= 0 |
The useEffectStyle
hook creates (or updates) EffectStyle
and returns an object that contains effectStyleId
and can be consumed in style
prop.
Args | Type | Default | Note |
---|---|---|---|
style |
Style Object |
The style will applied to a local style |
|
style.shadowType |
DROP_SHADOW or INNER_SHADOW |
DROP_SHADOW |
Type of shadow effect |
style.shadowSpread |
number |
0 |
Shadow expansion distance |
params |
Object |
||
params.id |
String |
A style id | |
params.name |
String |
A style name | |
params.description |
String |
A style description |
Text
component got hyperlink prop supporting.onNodeId
callback supporting. onNodeId
returns Figma Node ID.An example:
<View>
<Text
style={{ color: '#308eff', marginBottom: 50 }}
hyperlink={{
type: 'URL',
value: 'https://react-figma.dev/'
}}>
React Figma website
</Text>
{nodeId && (
<Text
style={{ color: '#308eff', marginBottom: 50 }}
hyperlink={{
type: 'NODE',
value: nodeId
}}>
Rectangle link
</Text>
)}
<View onNodeId={setNodeId}>
<View style={{ width: 200, height: 100, backgroundColor: '#dd55aa' }} />
</View>
</View>
Example:
<View
style={{
shadows: [{
shadowColor: 'rgba(0, 0, 0, 0.2)', shadowRadius: 1
}, {
shadowColor: 'rgba(0, 0, 0, 0.3)', shadowRadius: 2
}]
}}
/>
A new prop has added in the Instance component:
detach: boolean;
When detach=true
an instance detached through detachInstance method.
Thanks, @n0ruSh!
Component
and ComponentSet
got publishable props supporting:
Prop | Type | Default | Note |
---|---|---|---|
description |
String |
'' |
The annotation entered by the user for this component |
documentationLinks |
ReadonlyArray<DocumentationLink> |
[] |
The documentation links for this component |
Introduced in the Figma API Version 1, Update 23