# SF Symbols

Typed Kotlin constants for Apple SF Symbols names used by macOS APIs.

`sf-symbols` provides Apple's [SF Symbols](https://developer.apple.com/sf-symbols/) names as
typed Kotlin constants. You write `SFSymbolObjectsAndTools.SCISSORS` instead of `"scissors"`, and
the compiler catches typos.

## Add the dependency

```kotlin title="build.gradle.kts"
dependencies {
    implementation("dev.nucleusframework:nucleus.sf-symbols:3.0.0")
}
```

[`menu-macos`](/docs/os/menus/menu-bar) already brings it.

## Reference a symbol

Pick the constant from the category enum that matches its use, and pass it to a macOS API that
takes a symbol:

```kotlin
val icon = NsMenuItemImage.SystemSymbol(SFSymbolObjectsAndTools.SCISSORS)

// A name the constants do not cover, such as one from a newer SF Symbols release
val custom = SFSymbol.Custom("bird.fill")
```

Number symbols take an underscore prefix, since Kotlin identifiers cannot start with a digit:
`SFSymbolNumbers._0_CIRCLE` maps to `"0.circle"`. SF Symbols need macOS 11 or later; the module
still compiles and loads on every OS.

- Each constant carries its name in `symbolName` (`GEAR` holds `"gear"`). `Custom` is an inline
  value class that wraps any string, passed unchanged.
- AppKit resolves the name with `imageWithSystemSymbolName:accessibilityDescription:` at render
  time, so the glyph follows the system appearance and you ship no image assets.

## API reference

`SFSymbol` is a sealed interface with 21 category enums plus `Custom(symbolName)`:

| Category | Examples |
| --- | --- |
| `SFSymbolGeneral` | `GEAR`, `GEARSHAPE` |
| `SFSymbolHuman` | `ACCESSIBILITY`, `BRAIN` |
| `SFSymbolShapes` | `APP`, `APP_BADGE` |
| `SFSymbolArrows` | `ARROW_LEFT`, `ARROW_CLOCKWISE` |
| `SFSymbolTransportation` | `AIRPLANE`, `AIRPLANE_ARRIVAL` |
| `SFSymbolObjectsAndTools` | `SCISSORS`, `FOLDER`, `TRASH` |
| `SFSymbolDevices` | `DESKTOPCOMPUTER`, `KEYBOARD` |
| `SFSymbolNumbers` | `_0_CIRCLE`, `_0_CIRCLE_FILL` |
| `SFSymbolWeather` | `CLOUD`, `SUN_MAX`, `BOLT` |
| `SFSymbolStatus` | `CHECKMARK`, `INFO_CIRCLE` |
| `SFSymbolCommerce` | `BAG`, `BAG_BADGE_PLUS` |
| `SFSymbolMedia` | `PLAY`, `PAUSE`, `STOP` |
| `SFSymbolLetters` | `A_CIRCLE`, `A_SQUARE` |
| `SFSymbolTextFormatting` | `BOLD`, `CHARACTER` |
| `SFSymbolCommunication` | `ENVELOPE`, `PHONE`, `MESSAGE` |
| `SFSymbolPower` | `POWER`, `POWER_CIRCLE` |
| `SFSymbolSecurity` | `KEY`, `KEY_FILL` |
| `SFSymbolHealth` | `ALLERGENS`, `BASEBALL` |
| `SFSymbolLocation` | `FLAG`, `COMPASS_DRAWING` |
| `SFSymbolTime` | `ALARM`, `ALARM_FILL` |
| `SFSymbolConnectivity` | `CABLE_COAXIAL`, `CABLE_CONNECTOR` |

## What's next

- [macOS menu bar](/docs/os/menus/menu-bar): use `SystemSymbol` icons on menu items.
- [FreeDesktop icon names](/docs/os/icons/freedesktop): the typed icon names for Linux.
- [OS integration](/docs/os): the other desktop modules.
