Origami Frontend Components & Services

JSDoc: o-typography

new Typography(typographyEl, opts)

Class constructor.

parameter type default description
typographyEl (optional) HTMLElement The root element to apply typography classes.
opts (optional) object {loadOnInit: true, rejectOnFontLoadFailure: false, fontLoadedCookieName: 'o-typography-fonts-loaded'} An options object for configuring o-typography.

Methods

Links

Typography.getOptions(typographyEl)

Static Method

Get the data attributes from the typographyEl. If typography is being set up declaratively, this method is used to extract the data attributes from the DOM.

parameter type default description
typographyEl HTMLElement The typography element in the DOM (Required)

Returns

  • Object.<string, any> - An option dictionary

Links

Typography.checkOptions(opts)

Static Method

Check the options passed in are valid, otherwise set defaults

parameter type default description
opts object An Object with configuration options for typography

Returns

  • object - opts

Links

Typography.init(rootElement, options)

Static Method

Initialise o-typography.

parameter type default description
rootElement HTMLElement | string The root element to intialise o-typography on, or a CSS selector for the root element
options (optional) object {} An options object for configuring o-typography

Returns

  • Typography - The Typography instance

Links

new Typography(typographyEl, opts)

Class constructor.

parameter type default description
typographyEl (optional) HTMLElement The root element to apply typography classes.
opts (optional) object {loadOnInit: true, rejectOnFontLoadFailure: false, fontLoadedCookieName: 'o-typography-fonts-loaded'} An options object for configuring o-typography.

Methods

Links

Status
active
Switch component view

GitHub: o-typography@7.4.1

Install o-typography

If using the Build Service, add o-typography@^7.4.1 to your script and link tags.

If using the npm package manager for a Manual Build, run npm install --save-peer "@financial-times/o-typography@^7.4.1".

Help & Support

o-typography is maintained directly by the Origami team. If you have any questions about o-typography or Origami in general, we are happy to help. 😊

Slack: #origami-support
Email: origami.support@ft.com

Feedback / Issues

To report a bug or request features please create an issue on Github. For support or general feedback please get in touch 😊

Slack: #origami-support
Email: origami.support@ft.com