Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember a user's choice in tabbed codeblocks #5764

Open
PaulAsjes opened this issue Jan 27, 2025 · 2 comments
Open

Remember a user's choice in tabbed codeblocks #5764

PaulAsjes opened this issue Jan 27, 2025 · 2 comments
Assignees
Labels
product/docs Fern Docs which builds and hosts a developer documentation site

Comments

@PaulAsjes
Copy link

PaulAsjes commented Jan 27, 2025

Feature Description

Codeblocks with tabbed interfaces are often used to show how to do one thing in several different languages. Currently a user has to manually click on their language of choice for each codeblock in the docs site. Instead the user's choice should be stored in a cookie and automatically switch each tabbed codeblock to their language of choice.

See the Stripe and WorkOS documentation for examples of this behaviour.

Use Case

If I'm viewing code heavy docs (like in a quick start) then I should only have to pick my programming language of choice once so the rest of the docs show that language without interference.

@PaulAsjes PaulAsjes added feature product/docs Fern Docs which builds and hosts a developer documentation site labels Jan 27, 2025
@dannysheridan
Copy link
Member

Great idea! @chdeskur built this.

PR to document: 66f146a
Documentation: https://buildwithfern.com/learn/docs/content/components/tabs

@PaulAsjes
Copy link
Author

Thanks, but I really wanted this for the <CodeBlock> component rather than tabs. For example:

<CodeBlock>
    ```bash title="Python" language="python"
    pip install elevenlabs
    ```

    ```bash title="JavaScript" language="javascript"
    npm install elevenlabs
    ```
</CodeBlock>

...

<CodeBlock>
    ```bash title="Python" language="python"
    pip install python-dotenv
    ```

    ```bash title="JavaScript" language="javascript"
    npm install dotenv
    ```
</CodeBlock>

Selecting the "javascript" tab in the first block would then move the 2nd block's tab to the same.

@fern-support fern-support reopened this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/docs Fern Docs which builds and hosts a developer documentation site
Development

No branches or pull requests

4 participants