-
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(Button): add focus method (#1764)
- Loading branch information
1 parent
d01d4fe
commit 553facc
Showing
5 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
docs/app/Examples/elements/Button/Usage/ButtonExampleFocus.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,28 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Grid } from 'semantic-ui-react' | ||
|
||
export default class ButtonExampleFocus extends Component { | ||
handleClick = () => this.ref.focus() | ||
|
||
handleRef = c => (this.ref = c) | ||
|
||
render() { | ||
return ( | ||
<Grid> | ||
<Grid.Column width={8}> | ||
<Button | ||
content='A button that can be focused' | ||
primary | ||
ref={this.handleRef} | ||
/> | ||
</Grid.Column> | ||
<Grid.Column width={8}> | ||
<Button | ||
content='Set focused' | ||
onClick={this.handleClick} | ||
/> | ||
</Grid.Column> | ||
</Grid> | ||
) | ||
} | ||
} |
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,16 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const ButtonUsageExamples = () => ( | ||
<ExampleSection title='Usage'> | ||
<ComponentExample | ||
title='Focus' | ||
description='A button can be focused.' | ||
examplePath='elements/Button/Usage/ButtonExampleFocus' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default ButtonUsageExamples |
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