Current version 22.0.0

Modal

import { TgModalComponent, TgModalBodyDirective, TgModalFooterDirective, TgModalHeaderDirective } from '@trademe/tangram';

A modal is a container for showing extra information or actions that relate to the page a user is on.

Example

When setting up your application, import TgTeleportModule into your root component and add <tg-teleport-outlet name="modal"></tg-teleport-outlet> to your root template.

Behaviour

  • Modals use tg-tab-trap by default. This means that the tab index will be limited to content inside the modal window. This is an important accessibility feature.
  • When a modal is triggered the modal content is moved to the top of the DOM, and the host element and class are lost. See the guide for customising modals.

Use a modal to provide additional information, or confirm an action that is relevant to a customer’s current task.

Characteristics

Helpful

Modals help a customer by providing information or a confirmation while keeping the customer’s place in a flow.

Respectful

Modals show up when invited, they’re never an unexpected party crasher. They’re always triggered by a customer interaction, and don’t appear out of the blue.

Focused

Modals are designed to interrupt a customer and focus their attention by obscuring the page content with an overlay. When a customer may need to reference information on the page, consider using a reveal, accordion or dropdown to disclose content.

Anatomy

Example of the anatomy of a modal with numbers directing the reader to the list below
anatomy images (optional)
  • 1

    Title

    The title sits in the modal header, and provides context for a customer.

  • 2

    Close button

    A customer should always have the option to dismiss a modal. By default, a customer can click outside of the modal to close it. If a critical decision must be made by the customer, use the required option.

  • 3

    Modal content

    Keep modal content concise, and avoid long forms where possible. Consider linking through to content on a separate page. When modal content extends beyond the height of the viewport, place it in a scrollable container.

  • Actions

    Actions sit in the modal footer. See our best practice for form action layout.

  • 4

    Primary action

    A modal has one primary action, with phrasing that relates to the task a customer is completing (eg. ‘Place bid’ rather than ‘Continue’).

  • 5

    Secondary action

    When the secondary action is a link back to the page, (eg. ‘Cancel’ or ‘Go back’) use the transparent button styling.

Proudly made by © 2026 Trade Me Limited