import { Controller } from "@hotwired/stimulus" import React from "react" import { createRoot } from "react-dom/client" import { Button } from "@/components/button" // Controller for testing shadcn/ui React components within a Stimulus context // Renders a React button component to verify the PostCSS and component setup export default class extends Controller { // Define targets for the controller static targets = ["container"] // Initialize and render the React component when the controller connects connect() { console.log("Shadcn Button Test Controller connected") this.renderButton() } // Render the React button component inside the target container renderButton() { const container = this.containerTarget const root = createRoot(container) root.render(
Ce bouton utilise shadcn/ui + Tailwind + PostCSS