Open ap0nia opened 5 days ago
The built-in TailwindCSS has caused some issues like style pollution since there are no prefix in built-in tailwind css classnames, we may change to use css modules or adding prefix for built-in tailwind classnames which has not been decided yet.
Therefore, I think option 1 or 3 is better, and below shows we mix the use of tailwindcss and css modules 😂
export const Blockquote = (props: ComponentProps<'blockquote'>) => {
return (
<blockquote
{...props}
className={`border-l-2 border-solid border-divider pl-4 my-6 transition-colors duration-500 ${styles.blockquote}`}
/>
);
};
You can implement a function that judge if there were no classes provided. If provided, do concat. If not, return do nothing.
What problem does this feature solve?
Currently, all of the internal components used by the
DocLayout
will completely override theclassName
property. For example, ul will always have "list-disc pl-5 my-4 leading-7". I think it should respect anyclassName
it gets from props, and attempt to merge them.The motivation for this is that I wrote a custom rehype plugin that adds custom classes to MDX elements, but these are stripped away by the components.
What does the proposed API look like?
However, this may add an extra space if there were no classes provided.
cn
utility for merging TailwindCSS classes.This would require additional packages to be installed, but they are small and might be useful in other places.
cn
to prevent additional dependencies.If any of these solutions seem acceptable, I can open a corresponding PR.