Styleframe Logo
Inline Text

Abbreviation Element

Style abbreviation elements with configurable cursor and text decoration using the useAbbrElement composable.
Part of the Global Preset:useAbbrElement is included in the Global Preset (useGlobalPreset) and you can configure it through the preset's abbr option. For most projects, applying it via the preset is the recommended approach.

Overview

The useAbbrElement composable styles abbr[title] elements with a help cursor and dotted underline, making it clear to users that a tooltip is available on hover.

useAbbrElement

function useAbbrElement(
    s: Styleframe,
    options?: WithThemes<AbbrElementConfig>
): AbbrElementResult
styleframe.config.ts
import { styleframe } from 'styleframe';
import { useAbbrElement } from '@styleframe/theme';

const s = styleframe();

const { abbrCursor, abbrTextDecoration } = useAbbrElement(s);

export default s;

Default Values

OptionDefaultVariableExport
cursor"help"--abbr--cursorabbrCursor
textDecoration"underline dotted"--abbr--text-decorationabbrTextDecoration

Custom Values

styleframe.config.ts
import { styleframe } from 'styleframe';
import { useAbbrElement } from '@styleframe/theme';

const s = styleframe();

const { abbrCursor, abbrTextDecoration } = useAbbrElement(s, {
    cursor: 'pointer',
    textDecoration: 'underline dashed',
});

export default s;

Best Practices

  • Keep the help cursor: The default help cursor signals to users that additional information is available on hover.
  • Use dotted underlines: The underline dotted decoration distinguishes abbreviations from regular links while indicating interactivity.
  • Always include a title attribute: The composable targets abbr[title], so elements without a title attribute are unaffected.