【发布时间】:2020-08-05 22:44:48
【问题描述】:
我是 TailWindCSS 的新手,我想为 Button 元素添加启用/禁用样式。如何有条件地向按钮添加禁用的特定样式/类(即假设我需要添加“opacity-50 cursor-not-allowed”)?
<button
className="bg-blue-500 hover:bg-blue-400 text-white font-bold py-2 px-4 border-b-4 border-blue-700 hover:border-blue-500 rounded mr-3"
disabled={!globalContext.users.length > 0}
onClick={handleClearResultsClick}
>
Clear Results
</button>
【问题讨论】:
-
是的,谢谢。
标签: css reactjs tailwind-css