diff --git a/README.md b/README.md index 2a3f961..52c4b0e 100644 --- a/README.md +++ b/README.md @@ -19,23 +19,52 @@ yarn add @mintlify/components - Node.js >= 20.0.0 - React ^18.0.0 or ^19.0.0 +- Tailwind CSS v3 or v4 + +## Setup + +### Tailwind v4 + +Import the styles at the **top** of your main CSS file, **before** `@import "tailwindcss"`: + +```css +@import "@mintlify/components/styles.css"; +@import "tailwindcss"; + +@theme { + --color-primary: #your-color; +} +``` + +### Tailwind v3 + +Import the styles at the **top** of your main CSS file: + +```css +@import "@mintlify/components/styles.css"; +@tailwind base; +@tailwind components; +@tailwind utilities; +``` + +Override theme values in `tailwind.config.js`. + +> **Note:** Importing styles before Tailwind ensures your custom theme values take precedence over the component defaults. ## Usage -Import components and styles in your project: +Import components in your React files: ```tsx import { Accordion, Callout, CodeBlock, Tabs } from '@mintlify/components'; -import '@mintlify/components/styles.css'; ``` ### Example ```tsx import { Callout } from '@mintlify/components'; -import '@mintlify/components/styles.css'; -function App() { +const App = () => { return ( This is an informational callout. diff --git a/packages/components/.storybook/preview.tsx b/packages/components/.storybook/preview.tsx index 4953e7a..7f82586 100644 --- a/packages/components/.storybook/preview.tsx +++ b/packages/components/.storybook/preview.tsx @@ -65,7 +65,7 @@ const preview: Preview = { `}
diff --git a/packages/components/src/code.css b/packages/components/src/code.css index 5e2b1e4..1aa54c3 100644 --- a/packages/components/src/code.css +++ b/packages/components/src/code.css @@ -164,8 +164,9 @@ html:not(.dark) .codeblock-light { } /* Lines of code outside code blocks. Generated when you use single ticks: `example` */ +/* biome-ignore lint/style/noDescendingSpecificity: TODO */ :not(pre) > code { - @apply break-words rounded-md px-2 py-0.5 text-gray-600 dark:text-gray-200 dark:border-gray-800 bg-gray-100/50 dark:bg-white/5; + @apply wrap-break-word rounded-md px-2 py-0.5 text-stone-600 dark:text-stone-200 dark:border-stone-800 bg-stone-100/50 dark:bg-white/5; } :not(pre) > code:before, @@ -208,6 +209,7 @@ html:not(.dark) .codeblock-light { /* line highlighting (without line numbers) */ [data-component-part="code-block-root"]:not(.has-line-numbers) { + /* biome-ignore lint/style/noDescendingSpecificity: TODO */ .line-highlight { background: color-mix( in srgb, @@ -325,15 +327,18 @@ html:not(.dark) .codeblock-light { } /* line numbers + highlighting */ +/* biome-ignore lint/style/noDescendingSpecificity: TODO */ .has-line-numbers .line-highlight { width: 100%; display: inline-block; position: relative; + /* biome-ignore lint/style/noDescendingSpecificity: TODO */ &::before { display: none; } + /* biome-ignore lint/style/noDescendingSpecificity: TODO */ &::after { content: ""; position: absolute; @@ -351,6 +356,7 @@ html:not(.dark) .codeblock-light { } } +/* biome-ignore lint/style/noDescendingSpecificity: TODO */ .has-line-numbers .line-diff { width: 100%; display: inline-block; diff --git a/packages/components/src/components/accordion/accordion-cover.tsx b/packages/components/src/components/accordion/accordion-cover.tsx index 10782e1..90c070d 100644 --- a/packages/components/src/components/accordion/accordion-cover.tsx +++ b/packages/components/src/components/accordion/accordion-cover.tsx @@ -25,7 +25,7 @@ const AccordionCover = ({ @@ -33,7 +33,7 @@ const AccordionCover = ({
{!!icon && (
{icon} @@ -56,14 +56,14 @@ const AccordionCover = ({ data-component-part="accordion-title-container" >

{title}

{!!description && (

{description} diff --git a/packages/components/src/components/accordion/accordion-group.tsx b/packages/components/src/components/accordion/accordion-group.tsx index 8c1ee9a..ed02eff 100644 --- a/packages/components/src/components/accordion/accordion-group.tsx +++ b/packages/components/src/components/accordion/accordion-group.tsx @@ -13,7 +13,7 @@ const AccordionGroup = ({ children, className }: AccordionGroupProps) => {

details+details]:border-t [&>details+details]:border-t-gray-200/70 dark:[&>details+details]:border-t-white/10 [&>details>summary]:rounded-none [&>details]:mb-0 [&>details]:rounded-none [&>details]:border-0", + "prose prose-stone dark:prose-invert mt-0 mb-3 overflow-hidden rounded-xl border border-stone-200/70 dark:border-white/10 [&>details+details]:border-t [&>details+details]:border-t-stone-200/70 dark:[&>details+details]:border-t-white/10 [&>details>summary]:rounded-none [&>details]:mb-0 [&>details]:rounded-none [&>details]:border-0", className )} data-component-part="accordion-group" diff --git a/packages/components/src/components/accordion/accordion.stories.tsx b/packages/components/src/components/accordion/accordion.stories.tsx index 0bcf1ac..21a43d3 100644 --- a/packages/components/src/components/accordion/accordion.stories.tsx +++ b/packages/components/src/components/accordion/accordion.stories.tsx @@ -60,7 +60,7 @@ export const WithDescription: Story = { title="Installation" >

Run the following command to install Mintlify:

-
npm install -g mintlify
+
npm install -g mintlify
-
+        
           {`{
   "name": "My Documentation",
   "navigation": []
@@ -259,20 +259,20 @@ export const WithURLManagement: Story = {
 
     return (
       
-
-

+

+

Current URL (Storybook iframe):

- + {currentUrl}
-

+

These accordions sync with the URL hash. Open an accordion and watch the URL update above. The URL is also copied to your clipboard automatically!

-

+

Note: In Storybook's iframe environment, URL changes aren't visible in the browser's address bar, but the feature works in production. The simulated URL display above shows what's happening. @@ -320,7 +320,7 @@ export const WithURLManagement: Story = { export const WithCallbacks: Story = { render: () => (

-

+

Open the browser console to see the callback logs.

Open/close tracking callbacks
  • Mount lifecycle callback
  • -

    +

    Check the browser console to see callback logs, and notice how the URL updates when you toggle this accordion!

    @@ -392,7 +392,7 @@ export const RichContent: Story = { >

    Here's how to use the Accordion component:

    -
    +          
                 {`Available Props:
               
    -              
    +              
    -              
    +              
    -              
    +              
    -              
    +              
    @@ -448,8 +448,8 @@ export const RichContent: Story = {
               

    Accordions can contain any type of content, including images:

    -
    - +
    + Image placeholder
    @@ -574,7 +574,7 @@ export const AccordionGroupWithRichContent: Story = {

    Install the package using your preferred package manager:

    -
    +          
                 npm install @mintlify/components
               
    @@ -585,7 +585,7 @@ export const AccordionGroupWithRichContent: Story = { title="Configuration" >

    Create a configuration file:

    -
    +          
                 {`{
       "theme": "light",
       "components": ["accordion", "badge"]
    @@ -599,7 +599,7 @@ export const AccordionGroupWithRichContent: Story = {
               title="Usage"
             >
               

    Import and use the components:

    -
    +          
                 {`import { Accordion } from '@mintlify/components';
     
     
    @@ -634,7 +634,7 @@ export const MultipleAccordionGroups: Story = {
       render: () => (
         
    -

    +

    Documentation

    @@ -666,7 +666,7 @@ export const MultipleAccordionGroups: Story = {
    -

    +

    Support

    diff --git a/packages/components/src/components/accordion/accordion.tsx b/packages/components/src/components/accordion/accordion.tsx index dd011ef..0a9ff20 100644 --- a/packages/components/src/components/accordion/accordion.tsx +++ b/packages/components/src/components/accordion/accordion.tsx @@ -187,7 +187,7 @@ const GenericAccordion = ({
    (
    -

    +

    Solid (Default)

    @@ -105,7 +105,7 @@ export const Variants: Story = {
    -

    +

    Outline

    @@ -137,7 +137,7 @@ export const WithIcon: Story = { render: () => (
    -

    +

    Lead Icons

    @@ -152,7 +152,7 @@ export const WithIcon: Story = {
    -

    +

    Tail Icons

    @@ -167,7 +167,7 @@ export const WithIcon: Story = {
    -

    +

    Both Lead and Tail Icons

    @@ -181,7 +181,7 @@ export const WithIcon: Story = {
    -

    +

    Inline SVG Icons

    @@ -226,7 +226,7 @@ export const WithIcon: Story = {
    -

    +

    Icon Types (Font Awesome Styles)

    @@ -246,7 +246,7 @@ export const WithIcon: Story = {
    -

    +

    Lucide Icon Library

    @@ -266,7 +266,7 @@ export const WithIcon: Story = {
    -

    +

    Icons with Different Sizes

    @@ -290,7 +290,7 @@ export const WithIcon: Story = { export const SurfaceVariants: Story = { render: () => ( -
    +
    White Surface White Destructive @@ -303,7 +303,7 @@ export const IconCombinations: Story = { render: () => (
    -

    +

    Icons with Outline Variant

    @@ -320,7 +320,7 @@ export const IconCombinations: Story = {
    -

    +

    Icons with Disabled State

    @@ -337,7 +337,7 @@ export const IconCombinations: Story = {
    -

    +

    Icons with Pill Shape

    @@ -354,7 +354,7 @@ export const IconCombinations: Story = {
    -

    +

    Inline SVG Icons with States

    @@ -422,7 +422,7 @@ export const IconCombinations: Story = {
    -

    +

    All States Combined

    @@ -454,7 +454,7 @@ export const CustomStyling: Story = { render: () => (
    -

    +

    Using className prop for custom styling

    @@ -496,7 +496,7 @@ export const Interactive: Story = { render: () => (
    -

    +

    Clickable Badges (onClick)

    @@ -519,7 +519,7 @@ export const Interactive: Story = {
    -

    +

    Link Badges (href)

    @@ -541,7 +541,7 @@ export const Interactive: Story = {
    -

    +

    Disabled Interactive Badges

    diff --git a/packages/components/src/components/callout/callout.tsx b/packages/components/src/components/callout/callout.tsx index 00bd86c..ca2935a 100644 --- a/packages/components/src/components/callout/callout.tsx +++ b/packages/components/src/components/callout/callout.tsx @@ -38,8 +38,8 @@ const variantConfig = { icon: InfoIcon, defaultAriaLabel: "Info", className: - "border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-white/10", - childrenClassName: "text-neutral-800 dark:text-neutral-300", + "border border-stone-200 bg-stone-50 dark:border-stone-700 dark:bg-white/10", + childrenClassName: "text-stone-800 dark:text-stone-300", }, warning: { icon: WarningIcon, @@ -126,13 +126,13 @@ const Callout = ({ } catch { finalColor = undefined; variantClassName = - "border border-zinc-500/20 bg-zinc-50/50 dark:border-zinc-500/30 dark:bg-zinc-500/10"; - childrenClassName = "text-zinc-900 dark:text-zinc-200"; + "border border-stone-500/20 bg-stone-50/50 dark:border-stone-500/30 dark:bg-stone-500/10"; + childrenClassName = "text-stone-900 dark:text-stone-200"; } } else { variantClassName = - "border border-zinc-500/20 bg-zinc-50/50 dark:border-zinc-500/30 dark:bg-zinc-500/10"; - childrenClassName = "text-zinc-900 dark:text-zinc-200"; + "border border-stone-500/20 bg-stone-50/50 dark:border-stone-500/30 dark:bg-stone-500/10"; + childrenClassName = "text-stone-900 dark:text-stone-200"; } } else { const config = variantConfig[variant]; @@ -180,7 +180,7 @@ const Callout = ({ )}
    ({ /> ) : (
    {icon} @@ -158,7 +158,7 @@ const GenericCard = ({ ({
    Prop Type Required
    title string Yes
    defaultOpen boolean Yes
    description string No