CodeSweeper
Removes redundant code from your components with a single click.
Preview
Removes redundant code from your components with a single click.
tokens: 0reduced: 0%
activitycombo x00/sbest x0
accordion.tsx
"use client"
import * as React from "react"
import { ChevronDown } from "lucide-react"
import { cn } from "@/lib/utils"
interface AccordionContextValue {
openValue: string
setOpenValue: (value: string) => void
}
const AccordionContext = React.createContext<AccordionContextValue | null>(null)
export function Accordion({
children,
defaultValue,
className,
}: {
children: React.ReactNode
defaultValue?: string
className?: string
}) {
const [openValue, setOpenValue] = React.useState(defaultValue ?? "")
return (
<AccordionContext.Provider value={{ openValue, setOpenValue }}>
<div className={cn("divide-y rounded-lg border", className)}>{children}</div>
</AccordionContext.Provider>
)
}Click any token to remove it from the bundle.
Installation
bash
npx shadcn@latest add https://ui.moyu.dev/r/code-sweeper.jsonUsage
tsx
import { CodeSweeper } from "@/components/moyu/code-sweeper"
export default function Example() {
return <CodeSweeper />
}API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| file | string | — | Source file to sweep |
| mode | "click" | "auto" | "click" | How tokens are removed |
| trackCombo | boolean | true | Show the combo streak meter |
| soundEnabled | boolean | false | Play feedback on each removal |