Typst Fumadocs

Typed HTML

Documentation for the typed functions.

A typed layer over raw HTML elements.

The html module provides a typed layer over the raw html.elem function that allows you to conveniently create HTML elements. HTML attributes are exposed as function parameters that accept Typst types and automatically take care of converting those into the appropriate HTML.

Some parameters are common to all typed HTML functions. These are listed at the bottom in the Global Attributes section instead of explicitly on each element for readability.

Example

#html.video(
  controls: true,
  width: 1280,
  height: 720,
  src: "sunrise.mp4",
)[
  Your browser does not support the video tag.
]

Hyperlink.

#html.a(
  download: str,
  href: str,
  hreflang: str,
  ping: str | array,
  referrerpolicy: none | str,
  rel: str | array,
  target: str,
  type: str,
  body
) -> content

Parameters

Prop

Type

Abbreviation.

#html.abbr(
  body
) -> content

Parameters

Prop

Type

Contact information for a page or article element.

#html.address(
  body
) -> content

Parameters

Prop

Type

Hyperlink or dead area on an image map.

#html.area(
  alt: str,
  coords: array,
  download: str,
  href: str,
  ping: str | array,
  referrerpolicy: none | str,
  rel: str | array,
  shape: str,
  target: str
) -> content

Parameters

Prop

Type

Self-contained syndicatable or reusable composition.

#html.article(
  body
) -> content

Parameters

Prop

Type

Sidebar for tangentially related content.

#html.aside(
  body
) -> content

Parameters

Prop

Type

Audio player.

#html.audio(
  autoplay: bool,
  controls: bool,
  crossorigin: str,
  loop: bool,
  muted: bool,
  preload: none | auto | str,
  src: str,
  body
) -> content

Parameters

Prop

Type

Keywords.

#html.b(
  body
) -> content

Parameters

Prop

Type

Base URL and default target navigable for hyperlinks and forms.

#html.base(
  href: str,
  target: str
) -> content

Parameters

Prop

Type

Text directionality isolation.

#html.bdi(
  body
) -> content

Parameters

Prop

Type

Text directionality formatting.

#html.bdo(
  body
) -> content

Parameters

Prop

Type

A section quoted from another source.

#html.blockquote(
  cite: str,
  body
) -> content

Parameters

Prop

Type

Document body.

#html.body(
  body
) -> content

Parameters

Prop

Type

Line break, e.g. in poem or postal address.

Button control.

#html.button(
  command: str,
  commandfor: str,
  disabled: bool,
  form: str,
  formaction: str,
  formenctype: str,
  formmethod: str,
  formnovalidate: bool,
  formtarget: str,
  name: str,
  popovertarget: str,
  popovertargetaction: str,
  type: str,
  value: str,
  body
) -> content

Parameters

Prop

Type

Scriptable bitmap canvas.

#html.canvas(
  height: int,
  width: int,
  body
) -> content

Parameters

Prop

Type

Table caption.

#html.caption(
  body
) -> content

Parameters

Prop

Type

Title of a work.

#html.cite(
  body
) -> content

Parameters

Prop

Type

Computer code.

#html.code(
  body
) -> content

Parameters

Prop

Type

Table column.

#html.col(
  span: int
) -> content

Parameters

Prop

Type

Group of columns in a table.

#html.colgroup(
  span: int,
  body
) -> content

Parameters

Prop

Type

Machine-readable equivalent.

#html.data(
  value: str,
  body
) -> content

Parameters

Prop

Type

Container for options for combo box control.

#html.datalist(
  body
) -> content

Parameters

Prop

Type

Content for corresponding dt element(s).

#html.dd(
  body
) -> content

Parameters

Prop

Type

A removal from the document.

#html.del(
  cite: str,
  datetime: datetime,
  body
) -> content

Parameters

Prop

Type

Disclosure control for hiding details.

#html.details(
  name: str,
  open: bool,
  body
) -> content

Parameters

Prop

Type

Defining instance.

#html.dfn(
  body
) -> content

Parameters

Prop

Type

Dialog box or window.

#html.dialog(
  open: bool,
  body
) -> content

Parameters

Prop

Type

Generic flow container, or container for name-value groups in dl elements.

#html.div(
  body
) -> content

Parameters

Prop

Type

Association list consisting of zero or more name-value groups.

#html.dl(
  body
) -> content

Parameters

Prop

Type

Legend for corresponding dd element(s).

#html.dt(
  body
) -> content

Parameters

Prop

Type

Stress emphasis.

#html.em(
  body
) -> content

Parameters

Prop

Type

Plugin.

#html.embed(
  height: int,
  src: str,
  type: str,
  width: int
) -> content

Parameters

Prop

Type

Group of form controls.

#html.fieldset(
  disabled: bool,
  form: str,
  name: str,
  body
) -> content

Parameters

Prop

Type

Caption for figure.

#html.figcaption(
  body
) -> content

Parameters

Prop

Type

Figure with optional caption.

#html.figure(
  body
) -> content

Parameters

Prop

Type

Footer for a page or section.

#html.footer(
  body
) -> content

Parameters

Prop

Type

User-submittable form.

#html.form(
  accept-charset: str,
  action: str,
  autocomplete: bool,
  enctype: str,
  method: str,
  name: str,
  novalidate: bool,
  rel: str | array,
  target: str,
  body
) -> content

Parameters

Prop

Type

Heading.

#html.h1(
  body
) -> content

Parameters

Prop

Type

Heading.

#html.h2(
  body
) -> content

Parameters

Prop

Type

Heading.

#html.h3(
  body
) -> content

Parameters

Prop

Type

Heading.

#html.h4(
  body
) -> content

Parameters

Prop

Type

Heading.

#html.h5(
  body
) -> content

Parameters

Prop

Type

Heading.

#html.h6(
  body
) -> content

Parameters

Prop

Type

Container for document metadata.

#html.head(
  body
) -> content

Parameters

Prop

Type

Introductory or navigational aids for a page or section.

#html.header(
  body
) -> content

Parameters

Prop

Type

Heading container.

#html.hgroup(
  body
) -> content

Parameters

Prop

Type

Thematic break.

Root element.

#html.html(
  body
) -> content

Parameters

Prop

Type

Alternate voice.

#html.i(
  body
) -> content

Parameters

Prop

Type

Child navigable.

#html.iframe(
  allow: str,
  allowfullscreen: bool,
  height: int,
  loading: str,
  name: str,
  referrerpolicy: none | str,
  sandbox: str | array,
  src: str,
  srcdoc: str,
  width: int,
  body
) -> content

Parameters

Prop

Type

Image.

#html.img(
  alt: str,
  crossorigin: str,
  decoding: auto | str,
  fetchpriority: auto | str,
  height: int,
  ismap: bool,
  loading: str,
  referrerpolicy: none | str,
  sizes: array,
  src: str,
  srcset: array,
  usemap: str,
  width: int
) -> content

Parameters

Prop

Type

Form control.

#html.input(
  accept: str | array,
  alpha: bool,
  alt: str,
  autocomplete: str | array,
  checked: bool,
  colorspace: str,
  dirname: str,
  disabled: bool,
  form: str,
  formaction: str,
  formenctype: str,
  formmethod: str,
  formnovalidate: bool,
  formtarget: str,
  height: int,
  list: str,
  max: float | datetime | str,
  maxlength: int,
  min: float | datetime | str,
  minlength: int,
  multiple: bool,
  name: str,
  pattern: str,
  placeholder: str,
  popovertarget: str,
  popovertargetaction: str,
  readonly: bool,
  required: bool,
  size: int,
  src: str,
  step: float | str,
  type: str,
  value: float | color | datetime | str | array,
  width: int
) -> content

Parameters

Prop

Type

An addition to the document.

#html.ins(
  cite: str,
  datetime: datetime,
  body
) -> content

Parameters

Prop

Type

User input.

#html.kbd(
  body
) -> content

Parameters

Prop

Type

Caption for a form control.

#html.label(
  for: str,
  body
) -> content

Parameters

Prop

Type

Caption for fieldset.

#html.legend(
  body
) -> content

Parameters

Prop

Type

List item.

#html.li(
  value: int,
  body
) -> content

Parameters

Prop

Type

Link metadata.

#html.link(
  as: str,
  blocking: str | array,
  color: color,
  crossorigin: str,
  disabled: bool,
  fetchpriority: auto | str,
  href: str,
  hreflang: str,
  imagesizes: array,
  imagesrcset: array,
  integrity: str,
  media: str,
  referrerpolicy: none | str,
  rel: str | array,
  sizes: array,
  type: str
) -> content

Parameters

Prop

Type

Container for the dominant contents of the document.

#html.main(
  body
) -> content

Parameters

Prop

Type

Image map.

#html.map(
  name: str,
  body
) -> content

Parameters

Prop

Type

Highlight.

#html.mark(
  body
) -> content

Parameters

Prop

Type

Menu of commands.

#html.menu(
  body
) -> content

Parameters

Prop

Type

Text metadata.

#html.meta(
  charset: str,
  content: str,
  http-equiv: str,
  media: str,
  name: str
) -> content

Parameters

Prop

Type

Gauge.

#html.meter(
  high: float,
  low: float,
  max: float,
  min: float,
  optimum: float,
  value: float,
  body
) -> content

Parameters

Prop

Type

Section with navigational links.

#html.nav(
  body
) -> content

Parameters

Prop

Type

Fallback content for script.

#html.noscript(
  body
) -> content

Parameters

Prop

Type

Image, child navigable, or plugin.

#html.object(
  data: str,
  form: str,
  height: int,
  name: str,
  type: str,
  width: int,
  body
) -> content

Parameters

Prop

Type

Ordered list.

#html.ol(
  reversed: bool,
  start: int,
  type: str,
  body
) -> content

Parameters

Prop

Type

Group of options in a list box.

#html.optgroup(
  disabled: bool,
  label: str,
  body
) -> content

Parameters

Prop

Type

Option in a list box or combo box control.

#html.option(
  disabled: bool,
  label: str,
  selected: bool,
  value: str,
  body
) -> content

Parameters

Prop

Type

Calculated output value.

#html.output(
  for: str | array,
  form: str,
  name: str,
  body
) -> content

Parameters

Prop

Type

Paragraph.

#html.p(
  body
) -> content

Parameters

Prop

Type

Image.

#html.picture(
  body
) -> content

Parameters

Prop

Type

Block of preformatted text.

#html.pre(
  body
) -> content

Parameters

Prop

Type

Progress bar.

#html.progress(
  max: float,
  value: float,
  body
) -> content

Parameters

Prop

Type

Quotation.

#html.q(
  cite: str,
  body
) -> content

Parameters

Prop

Type

Parenthesis for ruby annotation text.

#html.rp(
  body
) -> content

Parameters

Prop

Type

Ruby annotation text.

#html.rt(
  body
) -> content

Parameters

Prop

Type

Ruby annotation(s).

#html.ruby(
  body
) -> content

Parameters

Prop

Type

Inaccurate text.

#html.s(
  body
) -> content

Parameters

Prop

Type

Computer output.

#html.samp(
  body
) -> content

Parameters

Prop

Type

Embedded script.

#html.script(
  async: bool,
  blocking: str | array,
  crossorigin: str,
  defer: bool,
  fetchpriority: auto | str,
  integrity: str,
  nomodule: bool,
  referrerpolicy: none | str,
  src: str,
  type: str,
  body
) -> content

Parameters

Prop

Type

Container for search controls.

#html.search(
  body
) -> content

Parameters

Prop

Type

Generic document or application section.

#html.section(
  body
) -> content

Parameters

Prop

Type

List box control.

#html.select(
  autocomplete: str | array,
  disabled: bool,
  form: str,
  multiple: bool,
  name: str,
  required: bool,
  size: int,
  body
) -> content

Parameters

Prop

Type

Shadow tree slot.

#html.slot(
  name: str,
  body
) -> content

Parameters

Prop

Type

Side comment.

#html.small(
  body
) -> content

Parameters

Prop

Type

Image source for img or media source for video or audio.

#html.source(
  height: int,
  media: str,
  sizes: array,
  src: str,
  srcset: array,
  type: str,
  width: int
) -> content

Parameters

Prop

Type

Generic phrasing container.

#html.span(
  body
) -> content

Parameters

Prop

Type

Importance.

#html.strong(
  body
) -> content

Parameters

Prop

Type

Embedded styling information.

#html.style(
  blocking: str | array,
  media: str,
  body
) -> content

Parameters

Prop

Type

Subscript.

#html.sub(
  body
) -> content

Parameters

Prop

Type

Caption for details.

#html.summary(
  body
) -> content

Parameters

Prop

Type

Superscript.

#html.sup(
  body
) -> content

Parameters

Prop

Type

Table.

#html.table(
  body
) -> content

Parameters

Prop

Type

Group of rows in a table.

#html.tbody(
  body
) -> content

Parameters

Prop

Type

Table cell.

#html.td(
  colspan: int,
  headers: str | array,
  rowspan: int,
  body
) -> content

Parameters

Prop

Type

Template.

#html.template(
  shadowrootclonable: bool,
  shadowrootcustomelementregistry: bool,
  shadowrootdelegatesfocus: bool,
  shadowrootmode: str,
  shadowrootserializable: bool,
  body
) -> content

Parameters

Prop

Type

Multiline text controls.

#html.textarea(
  autocomplete: str | array,
  cols: int,
  dirname: str,
  disabled: bool,
  form: str,
  maxlength: int,
  minlength: int,
  name: str,
  placeholder: str,
  readonly: bool,
  required: bool,
  rows: int,
  wrap: str,
  body
) -> content

Parameters

Prop

Type

Group of footer rows in a table.

#html.tfoot(
  body
) -> content

Parameters

Prop

Type

Table header cell.

#html.th(
  abbr: str,
  colspan: int,
  headers: str | array,
  rowspan: int,
  scope: str,
  body
) -> content

Parameters

Prop

Type

Group of heading rows in a table.

#html.thead(
  body
) -> content

Parameters

Prop

Type

Machine-readable equivalent of date- or time-related data.

#html.time(
  datetime: datetime | duration,
  body
) -> content

Parameters

Prop

Type

Document title.

#html.title(
  body
) -> content

Parameters

Prop

Type

Table row.

#html.tr(
  body
) -> content

Parameters

Prop

Type

Timed text track.

#html.track(
  default: bool,
  kind: str,
  label: str,
  src: str,
  srclang: str
) -> content

Parameters

Prop

Type

Unarticulated annotation.

#html.u(
  body
) -> content

Parameters

Prop

Type

List.

#html.ul(
  body
) -> content

Parameters

Prop

Type

Variable.

#html.var(
  body
) -> content

Parameters

Prop

Type

Video player.

#html.video(
  autoplay: bool,
  controls: bool,
  crossorigin: str,
  height: int,
  loop: bool,
  muted: bool,
  playsinline: bool,
  poster: str,
  preload: none | auto | str,
  src: str,
  width: int,
  body
) -> content

Parameters

Prop

Type

Line breaking opportunity.

On this page