-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optionally Controlled textinput (#1357)
* value for text input * number input
- Loading branch information
Showing
6 changed files
with
77 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { create, tsx } from '@dojo/framework/core/vdom'; | ||
import icache from '@dojo/framework/core/middleware/icache'; | ||
import TextInput from '@dojo/widgets/text-input'; | ||
import Button from '@dojo/widgets/button'; | ||
|
||
const factory = create({ icache }); | ||
|
||
const Example = factory(function Controlled({ middleware: { icache } }) { | ||
return ( | ||
<virtual> | ||
<TextInput | ||
value={icache.getOrSet('value', '')} | ||
onValue={(value) => { | ||
icache.set('value', value); | ||
}} | ||
> | ||
{{ label: 'Controlled input with reset' }} | ||
</TextInput> | ||
<Button | ||
onClick={() => { | ||
icache.set('value', ''); | ||
}} | ||
> | ||
Reset input | ||
</Button> | ||
<div>The value text input is: "{icache.getOrSet('value', '')}"</div> | ||
</virtual> | ||
); | ||
}); | ||
|
||
export default Example; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters