How to Get the Icon Name from an Icon Instance in Figma Code Connect?
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Dokumentation
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- figma, typescript
- Bereich
- tooling
Rechercherichtung
Start with the Code Connect API documentation and the implementation for figma.instance, which the issue uses in its TypeScript example. Check whether the instance exposes a supported name or SVG property and how examples serialize it. Done means documenting a supported way to read the icon name, or clarifying that Code Connect does not expose one.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Please provide:
Summary
I am trying to extract the icon name (SVG name) from an icon instance in Figma using Code Connect, but I am not sure which property of the icon instance holds the actual name.
Details
Given an icon instance with these properties in the component:
| Property | Value |
|---|---|
| Button | True |
| Is Toggled | False |
| Ix Background | False |
| Size | Medium |
| Icon | home (Instance type) |
| Badge | False |
| Keyboard Focus | False |
And the following code structure:
{
props: {
icon: figma.instance('Icon'),
size: figma.enum('Size', {
'Extra Small': 'xs',
Small: 's',
Medium: 'm',
Large: 'l',
}),
badge: figma.boolean('Badge'),
button: figma.boolean('Button'),
},
example: (props: {
icon: any;
size?: string;
badge?: boolean;
button?: boolean;
}) => html`
<ct-icon
icon="${props.icon}"
size="${props.size}"
badge="${props.badge}"
button="${props.button}"
>
</ct-icon>
`,
}
after publishing above code to figma, code connect code looks like as below,
<sh-icon
**icon="Code Connect Error: Unsupported type 'object' for attribute"**
size="m"
button
></sh-icon>
Question
How do I get the icon name from the icon instance?
From the properties above, is the Icon property (with value home) the correct way to get the icon name?
If not, which property or method should I use to get the SVG/icon name from the icon instance programmatically?
Expected Outcome
- Guidance on which property contains the actual icon name.
- Example on how to extract or read the icon name from the instance for further use.
Thank you!
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1.6k
- Forks
- 126
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus figma/code-connect
-
normalizePropName strips `#` characters from Figma property names instead of only the `#id` suffixOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
figma/code-connect#419 ·
-
feature request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
figma/code-connect#403 ·
-
feature request
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
figma/code-connect#414 ·
-
feature request
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
figma/code-connect#413 · 1 Kommentar ·
-
feature request
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 54/100
figma/code-connect#412 · 1 Kommentar ·
Alle Issues in figma/code-connect
Ähnliche Issues
-
area: web
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
inabagumi/shinju-date#6823 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
vercel-labs/ui#540 ·
Maintainer antworten meist innerhalb von 1 Tag
-
accepted ai-dev ai-implementing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
livesport/homer#218 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag