Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Link component #298

Open
eric-net opened this issue Aug 21, 2024 · 0 comments
Open

Add Link component #298

eric-net opened this issue Aug 21, 2024 · 0 comments

Comments

@eric-net
Copy link

eric-net commented Aug 21, 2024

can create a single React component that integrates a command item with a link, using Headless UI's Menu component for a more customized approach. This example will include the Link, Cog6ToothIcon, and basic styling, all within one component.

import React from 'react';
import { Menu } from '@headlessui/react';
import Link from 'next/link'; // Assuming you're using Next.js
import { Cog6ToothIcon } from '@heroicons/react/outline';

const CommandLinkItem = () => {
  return (
    <Menu as="div" className="relative inline-block text-left">
      <Menu.Items className="absolute mt-2 w-56 origin-top-right bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
        <Menu.Item>
          {({ active }) => (
            <Link href="/settings">
              <a
                className={`${
                  active ? 'bg-blue-500 text-white' : 'text-gray-900'
                } group flex rounded-md items-center w-full px-2 py-2 text-sm`}
              >
                <Cog6ToothIcon className="w-5 h-5 mr-2" aria-hidden="true" />
                Settings
              </a>
            </Link>
          )}
        </Menu.Item>
        {/* Add more Menu.Item components as needed */}
      </Menu.Items>
    </Menu>
  );
};

export default CommandLinkItem;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant