Skip to content

Setup

API: Fx · Managers: FontManager, IconManager, ThemeManager

SalsaFX exposes a global Fx facade for app-wide setup. Call Fx.configure() once at startup (and again whenever you need to change settings).


import { Fx, IconPacks, Fonts, DisplayFonts, Themes } from '@salsafx/ui';
Fx.configure({
uiFont: Fonts.Manrope,
displayFont: DisplayFonts.Segmented,
iconPacks: [IconPacks.FontAwesome],
theme: Themes.SilverBlue,
});

Fx.configure is chainable and merges with the current configuration.


MemberKindDescription
configure(settings?)methodMerge settings and apply. Returns Fx.
apply()methodRe-apply the current configuration. Returns Fx.
use(configurator)methodRegister an additional configurator. Returns Fx.
configurationgetterResolved configuration after the last configure/apply.
defaultsgetterDefault configuration from registered managers.
FontscatalogBuilt-in UI faces for uiFont.
DisplayFontscatalogDisplay style presets for displayFont.
ThemescatalogNamed look presets for theme.
IconPackscatalogBuilt-in icon pack URLs.

Controls the global UI face and the display / value style.

SettingTypeDefaultDescription
uiFontFonts.*, catalog key, or { family, href }Fonts.ManropeFace for general chrome.
displayFontDisplayFonts.*, catalog key, { family, href }, or "uiFont"DisplayFonts.SegmentedFace for digital / value typography. Use "uiFont" or DisplayFonts.Classic to mirror the UI face.
KeySource
Fonts.ManropeBundled with the package
Fonts.InterBundled with the package
Fonts.NotoSansBundled with the package
Fonts.OxaniumBundled with the package
Fonts.ChakraPetchBundled with the package
Fonts.DsDigitalCDN (network required)
KeyNotes
DisplayFonts.SegmentedClassic 7-segment digital style (default). Uses Fonts.DsDigital (CDN).
DisplayFonts.ModernFuturistic, high-tech geometric style (bundled).
DisplayFonts.ClassicSame face as the active UI setting.
Fx.configure({
uiFont: Fonts.Manrope,
displayFont: DisplayFonts.Segmented,
});
Fx.configure({
uiFont: Fonts.Inter,
displayFont: 'uiFont',
});
Fx.configure({
uiFont: {
family: 'MyUi',
href: 'https://example.com/my-ui.css',
},
});
PropertyDescription
--fx-font-familyUI font family.
--fx-display-font-familyDisplay font family.

Optional icon pack stylesheets. Nothing is loaded by default.

SettingTypeDefaultDescription
iconPacksstring[][]Catalog URLs (IconPacks.*) and/or custom stylesheet URLs.
KeyPackSource
IconPacks.FontAwesomeFont AwesomeBundled with the package
IconPacks.MaterialDesignMaterial Design IconsCDN
IconPacks.MaterialSymbolsMaterial Symbols OutlinedCDN
IconPacks.LucideLucideCDN
IconPacks.PhosphorPhosphor (regular)CDN
IconPacks.TablerTabler IconsCDN
Fx.configure({
iconPacks: [IconPacks.FontAwesome, IconPacks.MaterialDesign],
});
Fx.configure({
iconPacks: [
IconPacks.Lucide,
'https://cdn.example.com/icons/my-pack.css',
],
});

Re-configuring iconPacks replaces the active set.


Sets the default named look for component groups, plus the default fill gradient triad. An instance can still override with its own theme attribute when supported.

SettingTypeDescription
themepreset key, Themes.*, or settings objectNamed preset or partial settings. Omitted keys keep their current value.
theme.componentspartial mapPer-group look.
theme.gradients{ start, middle, end }Default fill colors for gauges, bars, and potentiometer.
StopDefault
start#06b6d4
middle#6366f1
end#a855f7
Fx.configure({
theme: {
gradients: {
start: '#22d3ee',
middle: '#3b82f6',
end: '#2563eb',
},
},
});
PropertyDescription
--fx-theme-gradient-startFill gradient start.
--fx-theme-gradient-middleFill gradient middle.
--fx-theme-gradient-endFill gradient end.
PresetNotes
Themes.DefaultLibrary defaults.
Themes.SilverBlueLighter silver shells; default fill triad.
Themes.DarkGreenDark green panels; amber / orange fill.
Fx.configure({ theme: Themes.DarkGreen });
// or
Fx.configure({ theme: 'SilverBlue' });
GroupLooksDefault
FxDisplaysilver, darkbluedarkblue
FxSwitchsnow, silversilver
FxLinearTrackElementsilver, darkdark
FxRadialGaugesilver, darksilver
FxPotentiometersilver, darksilver
FxCardsilver, darkgreen, iron, dark, darkblue, darkergreen, snowiron
FxGroupBoxsilver, darkgreen, iron, dark, darkblue, darkergreen, snowiron
FxTabsdarkgreen, iron, darkergreendarkergreen

FxLinearTrackElement covers linear shells (fader, linear bar, and related linear gauges).

LookHex
silver#1e293b
darkgreen#131920
iron#111827
dark#080b10
darkblue#0b111f
darkergreen#0c0e12
snow#ffffff
Fx.configure({
theme: {
components: {
FxCard: 'darkgreen',
FxGroupBox: 'darkgreen',
FxTabs: 'darkergreen',
FxRadialGauge: 'silver',
},
},
});
<fx-card theme="darkergreen" title="Alarms"></fx-card>
<fx-display theme="silver" label="Temp" value="42"></fx-display>

Partial theme.components and theme.gradients updates merge into the existing values.