MCPcopy Create free account
hub / github.com/shipshapecode/shepherd / StepOptionsButton

Interface StepOptionsButton

shepherd.js/src/step.ts:249–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249export interface StepOptionsButton {
250 /**
251 * A function executed when the button is clicked on
252 * It is automatically bound to the `tour` the step is associated with, so things like `this.next` will
253 * work inside the action.
254 * You can use action to skip steps or navigate to specific steps, with something like:
255 * ```js
256 * action() {
257 * return this.show('some_step_name');
258 * }
259 * ```
260 */
261 action?: (this: Tour) => void;
262
263 /**
264 * Additional HTML attributes to apply to the button element.
265 *
266 * This is useful for adding data attributes for testing or analytics,
267 * or other custom attributes that don't have dedicated properties.
268 *
269 * Note: These attributes are applied before Shepherd's core attributes,
270 * so they cannot override critical properties like `type`, `onclick`,
271 * `class`, `disabled`, `aria-label`, or `tabindex`. Use the dedicated
272 * properties (`classes`, `disabled`, `label`, `action`) to control those.
273 *
274 * @example
275 * ```js
276 * {
277 * text: 'Next',
278 * action: tour.next,
279 * attrs: {
280 * 'data-test': 'next-button',
281 * 'data-analytics-id': 'tour-next',
282 * 'title': 'Proceed to the next step'
283 * }
284 * }
285 * ```
286 */
287 attrs?: Record<string, string | number | boolean>;
288
289 /**
290 * Extra classes to apply to the `<a>`
291 */
292 classes?: string;
293
294 /**
295 * Whether the button should be disabled
296 * When the value is `true`, or the function returns `true` the button will be disabled
297 */
298 disabled?: boolean | (() => boolean);
299
300 /**
301 * The aria-label text of the button
302 */
303 label?: StringOrStringFunction;
304
305 /**
306 * A boolean, that when true, adds a `shepherd-button-secondary` class to the button.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected