-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Input): add focus() method (#1477)
* fix(ComponentDoc): copy current editor code * fix(Button): fix oneOfType propType * feat(Input): add focus() method
- Loading branch information
1 parent
67c737f
commit 6cc4884
Showing
7 changed files
with
66 additions
and
3 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
23 changes: 23 additions & 0 deletions
23
docs/app/Examples/elements/Input/Usage/InputExampleRefFocus.js
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,23 @@ | ||
import React, { Component } from 'react' | ||
import { Input, Button } from 'semantic-ui-react' | ||
|
||
class InputExampleRefFocus extends Component { | ||
handleRef = c => { | ||
this.inputRef = c | ||
} | ||
|
||
focus = () => { | ||
this.inputRef.focus() | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<Button content='focus' onClick={this.focus} /> | ||
<Input ref={this.handleRef} placeholder='Search...' /> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default InputExampleRefFocus |
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,15 @@ | ||
import React from 'react' | ||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const InputUsageExamples = () => ( | ||
<ExampleSection title='Usage'> | ||
<ComponentExample | ||
title='Focus' | ||
description='An input can be focused via a ref.' | ||
examplePath='elements/Input/Usage/InputExampleRefFocus' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default InputUsageExamples |
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