Structure
Address Element
Style address elements with configurable bottom margin using the useAddressElement composable.
Part of the Global Preset:
useAddressElement is included in the Global Preset (useGlobalPreset) and you can configure it through the preset's address option. For most projects, applying it via the preset is the recommended approach.Overview
The useAddressElement composable styles the address element with consistent bottom margin, resets the default italic font style to normal, and inherits the parent line height.
useAddressElement
function useAddressElement(
s: Styleframe,
options?: WithThemes<AddressElementConfig>
): AddressElementResult
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useAddressElement } from '@styleframe/theme';
const s = styleframe();
const { addressMarginBottom } = useAddressElement(s);
export default s;
styleframe/index.css
:root {
--address--margin-bottom: var(--spacing);
}
address {
margin-bottom: var(--address--margin-bottom);
font-style: normal;
line-height: inherit;
}
Default Values
| Option | Default | Variable | Export |
|---|---|---|---|
marginBottom | "@spacing" | --address--margin-bottom | addressMarginBottom |
The composable also applies fixed styles that are not configurable: font-style: normal and line-height: inherit.
Custom Values
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useAddressElement } from '@styleframe/theme';
const s = styleframe();
const { addressMarginBottom } = useAddressElement(s, {
marginBottom: '@spacing.lg',
});
export default s;
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useGlobalPreset } from '@styleframe/theme';
const s = styleframe();
const { address } = useGlobalPreset(s, {
address: {
marginBottom: '@spacing.lg',
},
});
export default s;
styleframe/index.css
:root {
--address--margin-bottom: var(--spacing--lg);
}
address {
margin-bottom: var(--address--margin-bottom);
font-style: normal;
line-height: inherit;
}
Best Practices
- Use spacing tokens: Reference design tokens like
@spacingor@spacing.lgto keep address margins consistent with the rest of your layout. - Rely on the font-style reset: The composable resets
font-styletonormal, removing the browser default italic styling on address elements.