Skip to content

Toolkit: Cocoa

Hylke Bons edited this page Feb 18, 2020 · 7 revisions

Make sure to read how to turn Figma layers into views first to get a basic understanding about how FigmaSharp renders views. This page will build on top of that.

Spec version: 0.1

Container views

Cocoa has these special kinds of container views:

πŸ”Ή Window
πŸ”Ή Sheet
πŸ”Ή Popover

Windows

A Properties group inside a component shows customization options that can be set or toggled. Hide/show layers to disable/enable these properties an example for a πŸ”Ή Window:

πŸ”Ή Window
    - Properties
        πŸ‘ close
        πŸ‘ min
        πŸ‘ max
        🏷 title
        πŸ‘ modal
        πŸ‘ resizable
        πŸ‘ centered
        πŸ‘ transparent

Alert

An Alert is a very common composition of controls.

|
+---+ Alert
|   |---- image "Icon"
|   |---- text "Message"
|   |---- text "Information"
|   |---+ "Accessories"
|   |---  πŸ”Ή Checkbox "Suppression"
|   |---+ "Response Buttons"
|   |   |-  πŸ”Ή Button
|   |   |-  πŸ”Ή Button
|   |---  πŸ”Ή Window
|

This is convenience group that gets translated into an Alert with all its properties. Use "Accessories" to add your custom controls.

Popover

πŸ”Ή Popover has different component variations depending on the orientation of the balloon. Use the one you want depending on which side of the balloon you'd like to be anchored.

Controls

Some controls have Small and Large variations. These work exactly the same as their standard counterparts.

Buttons

πŸ”Ή Button
πŸ”Ή Pop Up Button
πŸ”Ή Pull Down Button
πŸ”Ή Checkbox
πŸ”Ή Radio

πŸ”Ή Checkbox and πŸ”Ή Radio have πŸ‘ On / πŸ‘ Off groups inside to set its default state.

πŸ”Ή Radio components placed in the same group modify the same option.

Fields

πŸ”Ή Textfield
πŸ”Ή Multiline Textfield
πŸ”Ή Combo Box

The 🏷 Placeholder layer contains the placeholder text shown when no text is in the field.

Tables

πŸ”Ή Table

Indicators

πŸ”Ή Progress Bar
πŸ”Ή Progress Spinner

πŸ”Ή Progress Bar has a πŸ‘ Indeterminate layer to reflect that state.

Styles

Fonts

🏷 Interactive Label/Standard
🏷 Interactive Label/Small
🏷 Interactive Label/Large
🏷 Non-interactive Label/Standard
🏷 Non-interactive Label/Small

Colours

Every colour you pick from the colour styles will be converted to a named colour value on macOS. For example, Text/Label Secondary is turned into NSColor.NSSecondaryLabelColor, and System/Green becomes NSColor.SystemGreen.

Images and Icons

This mainly specifies the geometry and constraints. A lookup is done for a matching NSImage on the system. This can also be overridden in code.

- image "NSComputer"

Text decoration and links

- label 1:https://www.microsoft.com/ 2:https://www.figma.com/

FigmaSharp will automatically replace underlined text with clickable links.