Skip to content

Instantly share code, notes, and snippets.

@starkraving
Last active June 22, 2021 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starkraving/6c7dd79711f6198870dcf4516fab6eab to your computer and use it in GitHub Desktop.
Save starkraving/6c7dd79711f6198870dcf4516fab6eab to your computer and use it in GitHub Desktop.
Using label for focus
const Component1 = () => (
<div className='col-sm-2 col-xs-12 p-2 border border-primary'>
<label for='myinput' className='btn btn-primary'>
Click to focus
</label>
</div>
);
const Component2 = () => (
<div className='col-sm-10 col-xs-12 p-2 border border-primary'>
<input id='myinput' type='text' className='form-control' />
</div>
);
export default function App() {
return (
<div className='container'>
<h1 className='text-center'>Label for Focus</h1>
<div className='row'>
<Component1 />
<Component2 />
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment