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

Simple styling with tailwind #143

Open
davidnoah opened this issue Jan 30, 2024 · 1 comment
Open

Simple styling with tailwind #143

davidnoah opened this issue Jan 30, 2024 · 1 comment

Comments

@davidnoah
Copy link

I know this is probably a big ask here, but it would be great for this package to be infinitely customizable an work with more modern frameworks like tailwind.

As of now its really hard to update any of the styles

@Hamdi235050
Copy link

Hello davidnoah
To make the package infinitely customizable and compatible with modern frameworks like Tailwind CSS, you could consider the following approach :

Move Styles to Configuration or Theme Files for exemple :
const defaultStyles = {
button: 'bg-blue-500 text-white px-4 py-2 rounded',
card: 'shadow-md border rounded-lg p-4',
};

export const getStyles = (customStyles) => ({
...defaultStyles,
...customStyles,
});
than Integrate Tailwind Compatibility
Instead of hardcoding styles, use utility classes from Tailwind CSS.
Provide a way for users to pass their own Tailwind classes.
Example:

const MyComponent = ({ customClasses = '' }) => {
return (
<div className={p-4 bg-gray-100 ${customClasses}}>
{/* Component Content */}

);
};
3. Expose a Configuration API
Add an API that lets developers inject their own theme or Tailwind classes.
You can allow them to pass a configuration object at initialization.
for example:

import { configure } from 'your-package';

configure({
theme: {
button: 'bg-green-500 hover:bg-green-600 text-white font-bold',
},
});
4. Provide a Default Tailwind Theme
Offer a pre-built Tailwind configuration as the default theme.
This makes it easier for users already using Tailwind.
Example:

const tailwindTheme = {
button: 'bg-blue-500 hover:bg-blue-600 text-white font-medium',
input: 'border rounded px-3 py-2 focus:ring focus:ring-blue-300',
};
Good Luck

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

2 participants