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.

How to style Label on TextInput ?

See original GitHub issue

Ask your Question

I want to make Label on textinput to small than text inside TextInput

import {
  configureFonts,
  DefaultTheme,
  DarkTheme,
  TextInput,
} from 'react-native-paper';

const fontConfig = {
  default: {
    regular: {
      fontFamily: Fonts.FONTS.PRIMARY,
      fontWeight: 'normal',
      fontSize: 10, // <-- Try using this but not work
    },
  },
};

const theme = {
  ...DarkTheme,
  roundness: 5,
  colors: {
    ...DarkTheme.colors,
    text: Theme.COLORS.WHITE,
    placeholder: Theme.COLORS.WHITE,
    primary: Theme.COLORS.SWITCH_ON,
    background: 'transparent',
  },
  fonts: configureFonts(fontConfig),
};

<TextInput
    theme={tema}
    style={inputStyles}
    selectionColor={Theme.COLORS.WHITE}
    underlineColor={Theme.COLORS.WHITE}
    dense={true}
    {...this.props}
/>

Screenshot :

Current : image

const styles = StyleSheet.create({
  input: {
    fontSize: 14,
  },
});

Expected : image

const styles = StyleSheet.create({
  input: {
    fontSize: 34,
  },
});

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
Trancevercommented, Dec 12, 2019

You can pass fontSize via style prop. However it will affect both label and input text. There is no way to change only one of them.

0reactions
Dybovskycommented, Nov 15, 2021

label={<Text style={{fontSize: 20}}>{t(‘PersonalDetailsYuvitalOrg:editInput.firstName’)}</Text>}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize TextInput Label of the react-native-paper in the ...
You can pass fontSize via style prop. However it will affect both label and input text. There is no way to change only...
Read more >
HTML Inputs and Labels: A Love Story | CSS-Tricks
There are two ways to pair a label and an input. One is by wrapping the input in a label (implicit), and the...
Read more >
The Label element - HTML: HyperText Markup Language | MDN
To explicitly associate a <label> element with an <input> element, you first need to add the id attribute to the <input> element. Next,...
Read more >
TextInput · React Native Paper
A component to allow users to input text. ... The text or component to use for the floating label. ... Whether to style...
Read more >
How to create fancy jumping text input labels - Bootcamp
Below is what the two cases look like expressed in CSS. The snippet sets the style of the label depending on the state...
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