Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export input HTMLInputElement in form components #1267

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkmoisen
Copy link

@mkmoisen mkmoisen commented Mar 3, 2024

πŸ“‘ Description

Adds an exported HTMLInputElement for all the form components.

The purpose is to allow parent components to get a reference to the HTML input/select/etc, for example to programmatically focus.

<script>
  import { Label, Input, Button } from 'flowbite-svelte';
  let element;
</script>

<div class="mb-6">
  <Label for="focus-input" class="block mb-2">Focus input</Label>
  <Input bind:element id="focus-input" size="lg" placeholder="Focus input" />
</div>

<div>
  <Button on:click={() => {element.focus()}}>
    Focus
  </Button>
</div>

Status

  • Not Completed
  • Completed

βœ… Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • I have checked the page with https://validator.unl.edu/
  • All the tests have passed
  • My pull request is based on the latest commit (not the npm version).

β„Ή Additional Information

Copy link

stackblitz bot commented Mar 3, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Mar 3, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
flowbite-svelte βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Mar 3, 2024 4:26pm
flowbite-svelte-update βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Mar 3, 2024 4:26pm

@mkmoisen
Copy link
Author

mkmoisen commented Mar 9, 2024

Hi @shinokada , any chance you can take a look at this when you have a moment?

This exposes the html elements for all the form elements, such that parent's are able to grab the element and focus for example.

@shinokada
Copy link
Collaborator

Thank you for the PR.

  1. There are conflicts. Is it possible to solve them?
  2. Can you add examples in the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants