Bluesky's "Application Layout Framework"
at docs 60 lines 1.8 kB view raw view rendered
1# Bluesky's "Application Layout Framework" AKA "ALF" 2 3Bluesky's design system and styling framework for React Native. ALF provides utility-first, atomic style objects that work across web, iOS, and Android. 4 5You use ALF by combining static atoms (frozen style objects) with dynamic theme atoms that adapt to the active color scheme. No runtime CSS generation, no style strings. You compose styles via arrays, the same way you already do in React Native. 6 7## Install 8 9```bash 10yarn add @bsky.app/alf 11``` 12 13Peer dependencies: `react@19`, `react-native@^0.81.1`. 14 15## Quick start 16 17Wrap your app in the `Provider` and pass it your themes: 18 19```tsx 20import { Provider, themes } from '@bsky.app/alf' 21 22function App() { 23 return ( 24 <Provider activeTheme="light" themes={themes}> 25 <Root /> 26 </Provider> 27 ) 28} 29``` 30 31Then use `atoms` for static layout and `useTheme()` for color: 32 33```tsx 34import { atoms as a, useTheme } from '@bsky.app/alf' 35 36function Card() { 37 const t = useTheme() 38 return ( 39 <View style={[a.flex_row, a.gap_md, a.p_lg, a.rounded_md, t.atoms.bg]}> 40 <Text style={[a.text_md, a.font_bold, t.atoms.text]}>Hello</Text> 41 </View> 42 ) 43} 44``` 45 46## Platform behavior 47 48ALF uses React Native's file extension convention (`.native.ts`) to resolve platform-specific code at build time. 49 50Notable differences on native: 51 52- `fixed` resolves to `position: 'absolute'` (fixed positioning not supported) 53- `sticky` resolves to an empty object 54- Border widths use `StyleSheet.hairlineWidth` instead of 1px 55- Shadows use native shadow props with `elevation`. On Fabric (the new architecture), shadows resolve to empty objects. 56- Web-only atoms (`inline`, `block`, `pointer`) resolve to empty objects 57 58## API reference 59 60See the [full API reference](./api-reference.md) for every export, token value, and platform-specific behavior.