Krisztián Nagy
Krisztián Nagy

Reputation: 142

How to create a password input with fabric ui react?

There is a TextField input in fabric ui, but I have not found a way to create a password field for a login form.

Edit:

I tried using the 'type' attribute but I get an error.

Property 'type' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<TextField> & Readonly<{ children?: ReactNode; }>

These are the related packages from package.json:

"office-ui-fabric-react": "^4.21.4",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"typescript": "^2.4.2"

This problem seems to be similar to mine: https://github.com/OfficeDev/office-ui-fabric-react/issues/2203 - I tried downgrading to TypeScript 2.2.2 but I get a ton of errors from the node_modules folder if I do that.

UPDATE: issue is fixed now. Updated packages and it's no longer there.

Upvotes: 3

Views: 2253

Answers (2)

Have you tried:

<TextField defaultValue='foo' name='bar' type='password' />

See this issue: https://github.com/OfficeDev/office-ui-fabric-react/issues/1127

And this issue: https://github.com/OfficeDev/office-ui-fabric-react/issues/574

UPDATE with response from my issue on github:

Go to my issue

micahgodbolt:

This was fixed sometime ago it seems. I have no trouble doing:

<TextField type='password' label='Default TextField'  />

and getting this:

image provided by the user micahgodbolt on the issue

If it's a typescript issue, we're working out some bugs with the most recent version of TS. Make sure you've updated to the most recent version of Fabric. I.E. it has nothing to do with text field and type password.

Upvotes: 2

MikeM
MikeM

Reputation: 27415

set type="password"

<TextField type="password" />

see also TextField type="password" · Issue #490 · OfficeDev/office-ui-fabric-react · GitHub

Upvotes: 1

Related Questions