You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将Primereact Button样式调整为PanelMenu头部项样式?

如何让PrimeReact Button组件样式与PanelMenu头部项完全一致

问题描述

我需要将<Button />组件的样式调整为与<PanelMenu />的头部项(示例中的**"New"**项)完全一致。我尝试过自定义类但未成功,也曾尝试在items中添加无子项的条目,但会显示空白区域并切换到expanded类,优先希望通过Button实现该效果。

代码示例

"use client";

import { Button } from "primereact/button";
import { PanelMenu } from "primereact/panelmenu";

const DashboardsPage = () => {
  const items = [
    {
      label: "New",
      items: [
        {
          label: "Project",
        },
        {
          label: "Other",
        },
      ],
    },
  ];

  return (
    <div className="flex flex-column">
      <Button>My Panel Header wannabe button</Button>
      <PanelMenu model={items} className=" w-full md:w-25rem text-sm" />
    </div>
  );
};

export default DashboardsPage;

内容的提问来源于stack exchange,提问作者Philip Alexander Hassialis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 03:32:06