question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow styles or classNames passthrough

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Johann01commented, Nov 21, 2022

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>
    </>
  );
0reactions
joekendalcommented, Dec 23, 2022

At least need to edit the Card rounded and shadow classes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing in class names to react components
Important thing to note: if props.styleName is optional and you omit it you will have undefined in your class list. So {`pill ${...
Read more >
Pass class names as props to React components
To pass class names as props to a React component, pass a string containing the class names as a prop. Destructure the prop...
Read more >
Class Names - Compiled CSS-in-JS
Composing styles through props allows your consumers to add and override styles. Make sure to pass through className and style . View transformed...
Read more >
Styles & CSS
Learn how to style components in Astro with scoped styles, external CSS, and tooling like Sass and PostCSS.
Read more >
Extracting reusable Tailwind CSS / React components - MakerX
The className attribute can easily get out of hand with all the Tailwind CSS classes ... This allows us to write really terse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found