Spotlight

A spotlight focuses attention on a specific part of the UI, like a button or an icon.

Installation

Package installation information
Installyarn add @atlaskit/spotlight
SourceBitbucket.org, (opens new window)
npm@atlaskit/spotlight, (opens new window)
Bundleunpkg.com, (opens new window)

PopoverContent props

back

Description

Invoked when the user clicks SpotlightSecondaryAction. If an onClick handler is provided to SpotlightSecondaryAction then that takes precedence, and back will be ignored.

Type(event: BackEvent) => void

children

Required
Description

The content to be rendered in PopoverContent. This is intended to be a SpotlightCard.

Pass ONE element. On the top-layer code path it is rendered into a flex-row host so the viewport cap can reach it, and a fragment's children would become side-by-side flex items. See children on Popover in @atlaskit/top-layer.

Typestring | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal

dismiss

Required
Description

Spotlights can be dismissed by:

  • Clicking the SpotlightDismissControl
  • Clicking any DOM element outside the spotlight (if shouldDismissOnClickOutside === true)
  • Pressing the Escape key

These events align to the React.MouseEvent<HTMLButtonElement, MouseEvent>, MouseEvent, and KeyboardEvent events respectively. Defaults to true.

Type(event: DismissEvent) => void

done

Description

Invoked when the user clicks SpotlightPrimaryAction. If an onClick handler is provided to SpotlightPrimaryAction then that takes precedence, and done will be ignored.

If done is passed to PopoverContent, then next cannot be passed. This will result in a type error.

Type(event: DoneEvent) => void

isVisible

Description

Controls whether or not PopoverContent is visible. Defaults to true.

Typeboolean

motion

Description

The motion to be applied to the SpotlightCard.

TypeReact.ComponentClass<{ children: React.ReactNode; }, any> | React.FunctionComponent<{ children: React.ReactNode; }>

next

Description

Invoked when the user clicks SpotlightPrimaryAction in a tour. If an onClick handler is provided to SpotlightPrimaryAction then that takes precedence, and next will be ignored.

If next is passed to PopoverContent, then done cannot be passed. This will result in a type error.

Type(event: NextEvent) => void

offset

Description

Distance the spotlight should be offset from the target in the format of [along, away] (units in px). Defaults to [0, 2] - which means the spotlight will be 2px away from the edge of the target specified by the placement prop.

Type[number, number]

placement

Required
Description

The position in relation to the target the content should be shown at.

Type"top-start" | "top-center" | "top-end" | "bottom-start" | "bottom-center" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end"

shouldDismissOnClickOutside

Description

Controls whether the 'dismiss' action is invoked when the user clicks outside the content. Defaults to true.

Typeboolean

strategy

Deprecated
Description

Describes the positioning strategy to use. By default, it is fixed, which positions the popper correctly when it's in the normal flow of the document. If your reference element is in an absolute container, like a modal, use the absolute strategy instead.

For more details see: https://popper.js.org/docs/v2/constructors/#strategy

Has no effect when platform-dst-top-layer-spotlight is enabled.

Type"absolute" | "fixed"

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

PopoverProvider props

children

Required
Description

The to be rendered in PopoverProvider. This is intended to be PopoverContent, and PopoverTarget.

Typestring | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal

PopoverTarget props

children

Required
Description

The content to be rendered in PopoverTarget. This is intended to be the element you want to point the spotlight at.

Typestring | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal

SpotlightCard props

children

Description

Elements to be rendered inside the SpotlightCard.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

placement

Description

The position in relation to the target the content should be shown at. Overrides PopoverContent.placement

Type"top-start" | "top-center" | "top-end" | "bottom-start" | "bottom-center" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end"

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLDivElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightActions props

children

Description

Elements to be rendered inside the SpotlightActions.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLDivElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightBody props

children

Required
Description

Textual content is required for all spotlights. It should be brief and direct to quickly elaborate on the value.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLDivElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightControls props

children

Description

Elements to be rendered inside the SpotlightFooter.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLDivElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightDismissControl props

autoFocus

Description

Specifies whether the dismiss button should be focused when the spotlight is rendered. For spotlights that are triggered by user-action, this should be true. In the event that a spotlight is rendered on page load, without explicit user interaction, this should be false.

Defaulttrue
Typeboolean

onClick

Description

The action to take when the button is clicked.

Type(e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLButtonElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightFooter props

children

Description

Elements to be rendered inside the SpotlightFooter.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLDivElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightHeader props

children

Description

Elements to be rendered inside the SpotlightHeader.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLDivElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightHeadline props

children

Required
Description

A brief and direct title to clearly communicate the intent.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLHeadingElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightMedia props

children

Required
Description

Media to be displayed. This can be an image, video, gif that helps communicate spotlight intent.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLDivElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightPrimaryAction props

appearance

Description

Visual style of the button. Defaults to outline.

Type"outline" | "primary"

aria-label

Description

An accessible label to read out in the event that the displayed text does not provide enough context.

Typestring

children

Required
Description

Text to be rendered inside the SpotlightActions.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

onClick

Description

The action to take when the button is clicked.

Type(e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLButtonElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightSecondaryAction props

aria-label

Description

An accessible label to read out in the event that the displayed text does not provide enough context.

Typestring

children

Required
Description

Text to be rendered inside the SpotlightActions.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

onClick

Description

The action to take when the button is clicked.

Type(e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLButtonElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightShowMoreControl props

onClick

Description

The action to take when the button is clicked.

Type(e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLButtonElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

SpotlightStepCount props

children

Description

Elements to be rendered inside the SpotlightStepCount.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

ref

Description

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}

Typestring | Ref<HTMLSpanElement>

testId

Description

A testId prop is provided for specified elements, which is a unique string that appears as a data attribute data-testid in the rendered code, serving as a hook for automated tests

Typestring

usePreloadMedia

A hook that preloads media (video or image) files so they are cached by the browser before being rendered. Once loaded, the browser cache will be used when the actual media element is displayed. This improves perceived performance when showing spotlight cards with media.

Supported MIME types

  • video/mp4
  • video/webm
  • video/ogg
  • video/mpeg
  • video/x-matroska
  • image/jpeg
  • image/png
  • image/gif
  • image/webp
  • image/svg+xml

Example

import { SpotlightMedia } from '@atlaskit/spotlight/media';
import { usePreloadMedia } from '@atlaskit/spotlight/use-preload-media';
import Image from '@atlaskit/image';
import imageSrc from './assets/image.png'

//...

usePreloadMedia(imageSrc, { mimetype: 'video/mp4' });

// ...

</SpotlightMedia>
    <Image src={imageSrc} alt='description' />
</SpotlightMedia>
Was this page helpful?
We use this feedback to improve our documentation.
© 2026 AtlassianTrademark, (opens new window)Privacy, (opens new window)License