Composables
Definition Lists Element
Style definition list elements (dl, dt, dd) with configurable margin, font weight, and spacing using the useDlElement, useDtElement, and useDdElement composables.
Overview
The definition list composables style the dl, dt, and dd elements for displaying term-description pairs. They control margin, font weight, and spacing to create readable, well-structured definition lists.
useDlElement
function useDlElement(
s: Styleframe,
options?: WithThemes<DlElementConfig>
): DlElementResult
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useDlElement } from '@styleframe/theme';
const s = styleframe();
const { dlMarginBottom } = useDlElement(s);
export default s;
styleframe/index.css
:root {
--dl--margin-bottom: var(--spacing);
}
dl {
margin-bottom: var(--dl--margin-bottom);
}
Default Values
| Option | Default | Variable | Export |
|---|---|---|---|
marginBottom | "@spacing" | --dl--margin-bottom | dlMarginBottom |
useDtElement
function useDtElement(
s: Styleframe,
options?: WithThemes<DtElementConfig>
): DtElementResult
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useDtElement } from '@styleframe/theme';
const s = styleframe();
const { dtFontWeight } = useDtElement(s);
export default s;
styleframe/index.css
:root {
--dt--font-weight: var(--font-weight--bold);
}
dt {
font-weight: var(--dt--font-weight);
}
Default Values
| Option | Default | Variable | Export |
|---|---|---|---|
fontWeight | "@font-weight.bold" | --dt--font-weight | dtFontWeight |
useDdElement
function useDdElement(
s: Styleframe,
options?: WithThemes<DdElementConfig>
): DdElementResult
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useDdElement } from '@styleframe/theme';
const s = styleframe();
const { ddMarginBottom, ddMarginLeft } = useDdElement(s);
export default s;
styleframe/index.css
:root {
--dd--margin-bottom: var(--spacing--xs);
--dd--margin-left: 0;
}
dd {
margin-bottom: var(--dd--margin-bottom);
margin-left: var(--dd--margin-left);
}
Default Values
| Option | Default | Variable | Export |
|---|---|---|---|
marginBottom | "@spacing.xs" | --dd--margin-bottom | ddMarginBottom |
marginLeft | "0" | --dd--margin-left | ddMarginLeft |
Custom Values
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useDlElement, useDtElement, useDdElement } from '@styleframe/theme';
const s = styleframe();
const { dlMarginBottom } = useDlElement(s, {
marginBottom: '@spacing.lg',
});
const { dtFontWeight } = useDtElement(s, {
fontWeight: '@font-weight.semibold',
});
const { ddMarginBottom, ddMarginLeft } = useDdElement(s, {
marginBottom: '@spacing.sm',
marginLeft: '@spacing.md',
});
export default s;
styleframe/index.css
:root {
--dl--margin-bottom: var(--spacing--lg);
--dt--font-weight: var(--font-weight--semibold);
--dd--margin-bottom: var(--spacing--sm);
--dd--margin-left: var(--spacing--md);
}
dl {
margin-bottom: var(--dl--margin-bottom);
}
dt {
font-weight: var(--dt--font-weight);
}
dd {
margin-bottom: var(--dd--margin-bottom);
margin-left: var(--dd--margin-left);
}
Best Practices
- Use all three together: The
dl,dt, andddcomposables are designed to work as a set for consistent definition list styling. - Keep terms bold: The default bold font weight for
dtelements establishes clear visual hierarchy between terms and descriptions. - Reset the left margin: The default
marginLeft: "0"removes the browser default indentation onddelements for a cleaner layout.
Code
Style inline code and preformatted text blocks with configurable font family, font size, and spacing using the useCodeElement and usePreElement composables.
Focus
Apply consistent focus-visible outline styles across all elements with configurable color, width, style, and offset using the useFocusState composable.