Composables
Address Element
Style address elements with configurable bottom margin using the useAddressElement composable.
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/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.