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

Allow styles or classNames passthrough #75

Closed
wburningham opened this issue Oct 7, 2022 · 8 comments · Fixed by #339
Closed

Allow styles or classNames passthrough #75

wburningham opened this issue Oct 7, 2022 · 8 comments · Fixed by #339
Labels
Priority: Medium This issue/feature is of medium priority Type: Feature New feature for existing component

Comments

@wburningham
Copy link

I'm trying to add a simple variation of small-caps to a Title component. I don't think this is possible today unless Tremor components pass through the styles or className props. I prefer to use Tailwind (I love that Tremor is built on top of it) and I would love to be able to add tailwind classes to Tremor components.

@mitrotasios
Copy link
Member

hi @wburningham, thanks a lot for the feedback! Unfortunately something like this is not possible at the moment, because we have defined interfaces with specific props for each component. Implementing a new prop such as className is rather tricky (for now) because most of the components are nested, thus we would need to think about an appropriate design to implement this. We are currently discussing what level of customisation we would like to give to the user, as we want to find a balance between easy-to-use/good looking components vs customisation tailored to everyone's use case. Therefore we are gathering feedback from our users to determine which path to follow. So we are always happy for any sort of input on the library! 😊

@Johann01
Copy link

A small trick that I use as a workaround maybe someone need is.

I do a wrapper div and then add the CSS with a selector:

 const CLASSES = clsx(
    "[&>div>table>tbody>tr>td]:!pb-2",
    "[&>div>table>tbody>tr>td]:!pt-2",
    "[&>div>table]:!h-96",
    "[&>div.tremor-base.tr-absolute]:!bg-white",
    "[&]:overflow-scroll h-96"
  );
  
  return (
    <>
      <div className={CLASSES}>
        <Table>
          <TableHead>
            <TableRow>
              <TableHeaderCell>Name</TableHeaderCell>
              <TableHeaderCell textAlignment="text-left">Leads</TableHeaderCell>
              <TableHeaderCell textAlignment="text-left">
                Sales ($)
              </TableHeaderCell>
              <TableHeaderCell textAlignment="text-left">
                Quota ($)
              </TableHeaderCell>
              <TableHeaderCell textAlignment="text-left">
                Variance
              </TableHeaderCell>
              <TableHeaderCell textAlignment="text-left">
                Region
              </TableHeaderCell>
              <TableHeaderCell textAlignment="text-left">
                Status
              </TableHeaderCell>
            </TableRow>
          </TableHead>
          <TableBody>
            {transactions.pages.map((item) => (
              <>
                {item.transactions.map((item) => (
                  <TableRow key={item.nameReferenzkonto}>
                    <TableCell>{item.nameReferenzkonto}</TableCell>
                    <TableCell textAlignment="text-left">
                      {item.verwendungszweck}
                    </TableCell>
                    <TableCell textAlignment="text-left">
                      {item.betrag}
                    </TableCell>
                    <TableCell textAlignment="text-left">
                      {item.waehrung}
                    </TableCell>
                    <TableCell textAlignment="text-left">
                      {item.buchungstag.toLocaleDateString()}
                    </TableCell>
                    <TableCell textAlignment="text-left">
                      {item.beguenstigterOrAuftraggeber}
                    </TableCell>
                  </TableRow>
                ))}
              </>
            ))}
          </TableBody>
        </Table>
        <Footer height="h-10">
          <div className="w-full" />
          <ButtonInline
            size="sm"
            text="Load more"
            icon={ArrowRightIcon}
            iconPosition="right"
            handleClick={() =>
              fetchNextPage({
                pageParam:
                  transactions.pages[transactions.pages.length - 1]?.cursor,
              })
            }
          />
        </Footer>
      </div>
    </>
  );

@joakimbeng
Copy link

To get the scrolling working with the sticky headers I did:

<div className="[&_>_div]:max-h-[42rem] [&_th]:bg-white">
  <Table>
    <TableHead>
		...

Thanks for the tip @Johann01!

@john-tipper
Copy link

Thanks for the tip @Johann01, I think this may be a way of injecting dark mode classes for #208.

@severinlandolt severinlandolt added Type: Feature New feature for existing component Priority: Medium This issue/feature is of medium priority and removed feedback labels Nov 30, 2022
@severinlandolt
Copy link
Member

Relates to #135

@joekendal
Copy link

At least need to edit the Card rounded and shadow classes

@github-actions
Copy link

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@steventsao
Copy link

steventsao commented Mar 13, 2023

because most of the components are nested, thus we would need to think about an appropriate design to implement this. We are currently discussing what level of customisation we would like to give to the user, as we want to find a balance between easy-to-use/good looking components vs customisation tailored to everyone's use case. Therefore we are gathering feedback from our users to determine which path to follow. So we are always happy for any sort of input on the library! 😊

Hi, is there a post on where tremor is going with the balance between "good looking" presets vs. customization with className? I imagine exposing className satisfies the customization needs, but what about the original intent of limiting customization for a good preset? I imagine that with className, there is no balancing anymore because the customization is infinite. That being said, infinite customization is not mutually exclusive with offering presets either.

Just curious from the standpoint of designing a library, thank you! @mitrotasios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium This issue/feature is of medium priority Type: Feature New feature for existing component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants