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.

Accept font-family property

See original GitHub issue

In tailwind.config.js, I want to implement the following component but I can’t because “font-family” is ignored

plugins: [
    plugin(function ({ addComponents }) {
      addComponents({
        h1: {
          fontFamily: 'Roboto_300Light',
          fontStyle: 'normal',
          fontWeight: '300',
          fontSize: 96,
          lineHeight: '7rem',
          letterSpacing: -1.5,
        },
      });
    }),
]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
buitrbao222commented, Nov 28, 2021

You can create your own custom styles object and pass it in the create function. For example:

import generatedStyles from 'styles.json';

const customStyles = {
  h1: {
    fontFamily: 'Roboto_300Light',
    fontStyle: 'normal',
    fontWeight: '300',
    fontSize: 96,
    lineHeight: '7rem',
    letterSpacing: -1.5,
  },
};

const { tailwind, getColor } = create({ ...generatedStyles, ...customStyles });

export { tailwind, getColor };

Now tailwind('h1') will work.

However, classes in customStyles won’t be suggested by the TailwindCSS Intellisense plugin because the plugin uses your tailwind.config.js file for suggestions.

0reactions
vadimdemedescommented, Jan 24, 2022

There seems to be plenty of tutorials about this, here’s one for example → https://dev.to/aneeqakhan/add-custom-fonts-in-react-native-0-63-for-ios-and-android-3a9e.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS font-family property - W3Schools
The font-family property specifies the font for an element. The font-family property can hold several font names as a "fallback" system.
Read more >
font-family - CSS: Cascading Style Sheets - MDN Web Docs
The font-family property specifies a list of fonts, from highest priority to lowest. Font selection does not stop at the first font in...
Read more >
CSS: font-family property - TechOnTheNet
The CSS font-family property defines a prioritized list of font family names to apply to an element. Syntax. The syntax for the font-family...
Read more >
TextElement.FontFamily Property (System.Windows.Documents)
This property specifies a preference only. If the specified font family is not available, the FlowDocument silently falls back to the font determined...
Read more >
How does the font-family property work in CSS? - Stack Overflow
The font-family property holds several font names to provide a "fallback" system. The browser tries each font family in the order that they...
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