OS integrationIcons
SF Symbols
Typed Kotlin constants for Apple SF Symbols names used by macOS APIs.
sf-symbols provides Apple's SF Symbols names as
typed Kotlin constants. You write SFSymbolObjectsAndTools.SCISSORS instead of "scissors", and
the compiler catches typos.
sf-symbolsGradle plugin: Not neededWindow runtime: Not neededAdd the dependency
dependencies {
implementation("dev.nucleusframework:nucleus.sf-symbols:3.0.0")
}menu-macos 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:
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.
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: use
SystemSymbolicons on menu items. - FreeDesktop icon names: the typed icon names for Linux.
- OS integration: the other desktop modules.
Was this page helpful?
Edit on GitHub
Last updated on