Skip to content

"Reset Button" option #10711

Closed
Closed

Description

@VibhorJaiswal

Have you read the Contributing Guidelines on issues?

Description

Like the existing 'CopyButton,' a 'ResetButton' would be a valuable addition. This feature can be used by websites, such as React Bootstrap, to allow users to reset example codes to their original state."

Has this been requested on Canny?

No response

Motivation

This option is available on some websites, such as MUI, and it enhances user experience by allowing users to easily restore example code to its original state.

API design

Here’s a rough design of how the feature could look. I’ve taken a screenshot from React Bootstrap's code editor and edited it to illustrate the idea.

image

Have you tried building it?

No response

Self-service

  • I'd be willing to contribute this feature to Docusaurus myself.

Activity

  1. added
    feature
    status: needs triage
    on Nov 22, 2024
  2. slorber commented on Nov 22, 2024

    @slorber
    Collaborator

    It's not clear what you mean by "reset to their original state"

    What is the "state"? The state of the buttons? (such as "return to line") or the state of the code block? (note: code blocks are usually stateless)

    Since you only link to MUI / Bootstrap landing pages, I'm not really able to see a concrete example. Can you link to an actual page/section instead please?

    Do you mean it's only for live playgrounds where you can edit the code block? Is the goal to "restore" the original code in that live playground?

  3. VibhorJaiswal commented on Nov 22, 2024

    @VibhorJaiswal
    Author

    @slorber

    What is the "state"? The state of the buttons? (such as "return to line") or the state of the code block? (note: code blocks are usually stateless)

    By "state," I mean the original code. If the user has modified the code, the "Reset" button would restore it to the original example provided.

    Since you only link to MUI / Bootstrap landing pages, I'm not really able to see a concrete example. Can you link to an actual page/section instead please?

    For example, this page on MUI features a "Reset demo" option in the code example:
    image
    Similarly, this feature can be used by websites like React Bootstrap (in here). It would look something similar to the design I’ve attached in the screenshot in the issue.

    Do you mean it's only for live playgrounds where you can edit the code block? Is the goal to "restore" the original code in that live playground?

    Yes, it’s specifically for live playgrounds where users can edit the code block. The goal is to provide an option to restore the original code.

    I hope I’ve addressed your questions. If anything is still unclear or if you need further details, let me know.

  4. removed
    status: needs triage
    on Nov 22, 2024
  5. slorber commented on Nov 22, 2024

    @slorber
    Collaborator

    Thanks, I understand now.

    Will need to think about it and see what to do for live playgrounds.

    There was also a related button placement improvement PR here: #10461

    We may want to place the buttons similarly for the live playgrounds to ensure some kind of UI consistency

  6. NPX2218 commented on Jan 19, 2026

    @NPX2218
    Contributor

    Hi! I'd like to work on this. I'll implement the Reset button for live code playgrounds and have a PR ready within 7 days

  7. added 4 commits that reference this issue on Jan 19, 2026
    3224e99
    0a87857
    8927cf2
    953c986
  8. added a commit that references this issue on Feb 19, 2026
    49619fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions