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

progress bar color react #670

Open
spyroot opened this issue Jan 10, 2025 · 0 comments
Open

progress bar color react #670

spyroot opened this issue Jan 10, 2025 · 0 comments

Comments

@spyroot
Copy link

spyroot commented Jan 10, 2025

Hi Folks,

based on doc I tried to use a color for progress bar but it does not work. if use default i.e no value it invisible. I think it take default theme color. if I indicate via color="x" based on theme docs. It doesn't work as well. Only way to make it work use style.

I'm not sure is bug or it should not work with react ?

import { useState } from "react";
import { ThemeProvider } from "./theme-provider";
import { ThemePanel, Flex, Button, Box } from "@radix-ui/themes";
import * as Progress from "@radix-ui/react-progress";

export default function App() {
  const [appearance, setAppearance] = useState("dark");
  const [progress, setProgress] = useState(0);

  const toggleTheme = () => setAppearance(appearance === "dark" ? "light" : "dark");

  return (
    <ThemeProvider appearance={appearance}>
      <Flex direction="column" align="center" justify="center" style={{ padding: "2rem" }}>
        <Button onClick={toggleTheme} variant="soft">Toggle Theme</Button>
        <ThemePanel />


        <Box maxWidth="300px">
          <Progress.Root size="1" color="accent"
          value={50} style={{ height: "10px", background: "var(--accent-7)" }}>
            <Progress.Indicator  
    style={{
      width: "50%", 
      height: "100%", 
      backgroundColor: "var(--accent-color)", 
      transition: "width 0.3s ease", 
    }}
/>
          </Progress.Root>
          <Button onClick={() => setProgress((prev) => Math.min(prev + 10, 100))}>Increase Progress</Button>
          </Box>
      </Flex>


    </ThemeProvider>
  );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant