<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-bibliography/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-bibliography

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-bibliography>` web component renders a single citation entry formatted according to a recognized academic style. It is a presentational component that takes structured metadata (author, title, publisher, date, location, URL) and composes it into a styled, correctly-punctuated reference line, replacing the manual assembly of a bibliography string.

#### Semantic Behavior

- **Citation formatting**: The `format` prop drives the entire output - field ordering, punctuation, separators, author-name abbreviation, and date layout. Switching formats re-composes the same metadata rather than just restyling it.
- **Author parsing**: `author` is parsed, not displayed verbatim. Names are split on commas into multiple authors, first/last names are detected by position (first name first: `Mario Rossi`; the spaces around each name are ignored), and composite first or last names can be grouped with single or double quotation marks (e.g. `'Jhon Arthur' Doe`). Each author is then abbreviated per the active format (APA initials, MLA full first name).
- **Date handling**: `date` accepts an ISO string or a numeric timestamp and renders inside a semantic `<time>` element; an invalid date renders as an empty date (APA keeps empty parentheses), and month names are localized in Italian.
- **Link vs. plain title**: When both `name` and `url` are set, the title renders as a link (`target="_blank"`) carrying the `rel` value; with `name` alone it renders as plain emphasized text, and without `name` there is no title at all.
- **No slots**: Content is built entirely from props; the component does not project slotted children.

#### Properties & Visual Configurations

- **`format`** selects the citation standard (`'apa'`, `'mla'`, `'turabian'`) and is the primary behavioral switch; pick it to match the referencing convention required by the document. APA puts the date in parentheses right after the authors, MLA/Turabian place the date at the end, and each applies its own punctuation between location, publisher, and date.
- **`rel`** sets the relationship attribute applied to the generated title link (`'external'` or `'author'`); it only takes effect when the title is rendered as a hyperlink.

#### Other behavioral props

- **`typography`** and **`variant`** set the text role and styling of the rendered citation; they affect appearance only, not the citation structure.

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/ui-bibliography--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `author` | `author` | `string \| undefined` | - | Specifies one or more authors, as a string. First name and Last name: "Jhon Doe", you can wrap first name or last name to crop them correctly: "'Jhon Arthur' Doe", "'Jhon Arthur' 'Doe Jhonson'", and for multiple authors, separated by commas, "'Jhon Arthur' 'Doe Jhonson', 'Mike Collins', Erik 'Ross Anderson'", you can use single or double quotation marks for composite names |
| `date` | `date` | `string \| undefined` | - | Specifies the date of the bibliography |
| `format` | `format` | `"apa" \| "mla" \| "turabian"` | `'apa'` | Specifies the bibliography format to rapresent the bibliography content |
| `location` | `location` | `string \| undefined` | - | Specifies the location of the bibliography |
| `name` | `name` | `string \| undefined` | - | Specifies the name of the bibliography |
| `publisher` | `publisher` | `string \| undefined` | - | Specifies the publisher of the bibliography |
| `rel` | `rel` | `"author" \| "external"` | `'external'` | Specifies relationship between the current document and the URL |
| `typography` | `typography` | `"caption" \| "detail" \| "label" \| "option" \| "paragraph" \| "tip"` | `'detail'` | Specifies the font typography of the element |
| `url` | `url` | `string \| undefined` | - | Specifies the URL of the bibliography |
| `variant` | `variant` | `"code" \| "info" \| "read" \| "title" \| undefined` | - | Specifies the variant for `typography` |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-bibliography-color` | Sets the text color of the component |

Only these are public. Its other 2 are internal: they may change in any release, do not set them.

## Dependencies

Uses: `mds-text`.
