Skip to content

Add a react component for the editor. #212

@Anderssxn

Description

@Anderssxn

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Im doing multi-tenant platform that requires creating themes for users websites. Currently i just have a code editor for users to write their own css but it would be cool to have a tweakcn editor built-in, since im already suggesting them to go the website and generate their theme there.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Implementation could be something like this. No need for AI generated themes or maybe use the editorOptions for selecting what values would be available for editing.

"use client";
import { useState } from "react";
import { ThemeEditor} from "@tweakcn/react";

export default function CustomEditor() {
    const editorOptions = {...} // default options
    const [theme, setTheme] = useState<string | null>(null); // css or json value for the tweakcn theme
    const handleThemeChange = (theme: string | null) => {
        setTheme(theme);
    }
  return <ThemeEditor theme={theme} onThemeChange={handleThemeChange} options={editorOptions}/>;
};

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

i was going to use https://github.com/programming-with-ia/shadcn-theme-editor but its not what i was aiming for.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions