admin管理员组文章数量:1026989
I am trying to use Chakra UI for styling my application and the select styling props are not working. For example, I tried using the Button component and the variant prop is not working but the size prop seems to be working.
To recreate the issue:
- npm create vite
- input the name of the project, select react and javascript
- go into the folder and npm i
- run npm i @chakra-ui/react @emotion/react
- run npm install -D @chakra-ui/cli
- run npx @chakra-ui/cli snippet add button 7.main.jsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.jsx'
import './index.css'
import { Provider } from "./components/ui/provider"
createRoot(document.getElementById('root')).render(
<StrictMode>
<Provider>
<App />
</Provider>
</StrictMode>,
)
- App.jsx
import './App.css'
import { Button } from "./components/ui/button"
function App() {
return (
<>
<Button variant="solid">Button</Button>
</>
)
}
export default App
I created a separate repo to see if I could get it to work, which produced a different result in terms of the style (the one in my actual application looks like the default React button event though it was imported from Chakra UI), but the problem still remains.
I checked the version and the imports but it is the most updated version and there doesn't seem to be anything else to import.
I am trying to use Chakra UI for styling my application and the select styling props are not working. For example, I tried using the Button component and the variant prop is not working but the size prop seems to be working.
To recreate the issue:
- npm create vite
- input the name of the project, select react and javascript
- go into the folder and npm i
- run npm i @chakra-ui/react @emotion/react
- run npm install -D @chakra-ui/cli
- run npx @chakra-ui/cli snippet add button 7.main.jsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.jsx'
import './index.css'
import { Provider } from "./components/ui/provider"
createRoot(document.getElementById('root')).render(
<StrictMode>
<Provider>
<App />
</Provider>
</StrictMode>,
)
- App.jsx
import './App.css'
import { Button } from "./components/ui/button"
function App() {
return (
<>
<Button variant="solid">Button</Button>
</>
)
}
export default App
I created a separate repo to see if I could get it to work, which produced a different result in terms of the style (the one in my actual application looks like the default React button event though it was imported from Chakra UI), but the problem still remains.
I checked the version and the imports but it is the most updated version and there doesn't seem to be anything else to import.
本文标签: reactjsChakra UI variant prop is not changing the style of the Button componentStack Overflow
版权声明:本文标题:reactjs - Chakra UI variant prop is not changing the style of the Button component - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745663866a2162057.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论