-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from qwikerx/feat/radio
feat: radio button
- Loading branch information
Showing
21 changed files
with
579 additions
and
2 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
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,18 @@ | ||
import { component$ } from '@builder.io/qwik' | ||
import { ComponentDocPage } from '~/components/ComponentDocPage/ComponentDocPage' | ||
import { DocumentHead } from '@builder.io/qwik-city' | ||
|
||
export default component$(() => { | ||
return ( | ||
<ComponentDocPage name="radio"> | ||
<div q:slot="explanation"> | ||
Get started with the radio component to let the user choose a single option from multiple options in the form of a circle based on multiple | ||
styles and colors. | ||
</div> | ||
</ComponentDocPage> | ||
) | ||
}) | ||
|
||
export const head: DocumentHead = () => ({ | ||
title: 'Qwik Radio - Flowbite', | ||
}) |
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,19 @@ | ||
import { component$ } from '@builder.io/qwik' | ||
import { ComponentDocPage } from '~/components/ComponentDocPage/ComponentDocPage' | ||
import { DocumentHead } from '@builder.io/qwik-city' | ||
|
||
export default component$(() => { | ||
return ( | ||
<ComponentDocPage name="select"> | ||
<div q:slot="explanation"> | ||
The select input component can be used to gather information from users based on multiple options in the form of a dropdown list and by | ||
browsing this page you will find multiple options, styles, sizes, and variants built with the utility classes from Tailwind CSS also available | ||
in dark mode.{' '} | ||
</div> | ||
</ComponentDocPage> | ||
) | ||
}) | ||
|
||
export const head: DocumentHead = () => ({ | ||
title: 'Qwik Select - Flowbite', | ||
}) |
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
30 changes: 30 additions & 0 deletions
30
apps/web/src/routes/examples/[theme-rtl]/radio/01-default/index@examples.tsx
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,30 @@ | ||
/** | ||
* title: Default | ||
* description: Use the default example of a radio component with the checked and unchecked state. | ||
*/ | ||
|
||
import { component$, useSignal } from '@builder.io/qwik' | ||
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout' | ||
import { StaticGenerateHandler } from '@builder.io/qwik-city' | ||
import { Radio } from 'flowbite-qwik' | ||
|
||
export default component$(() => { | ||
const pick = useSignal<string>('') | ||
|
||
return ( | ||
<> | ||
<div class="p-3 flex flex-col gap-3"> | ||
<Radio name="radio" value="one" bind:option={pick}> | ||
First option | ||
</Radio> | ||
<Radio name="radio" value="two" bind:option={pick}> | ||
Second option | ||
</Radio> | ||
</div> | ||
</> | ||
) | ||
}) | ||
|
||
export const onStaticGenerate: StaticGenerateHandler = async () => { | ||
return staticGenerateHandler() | ||
} |
40 changes: 40 additions & 0 deletions
40
apps/web/src/routes/examples/[theme-rtl]/radio/02-colors/index@examples.tsx
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,40 @@ | ||
/** | ||
* title: Color | ||
* description: This example can be used for the color of the radio component by applying the color attribute to the input element. | ||
*/ | ||
|
||
import { component$, useSignal } from '@builder.io/qwik' | ||
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout' | ||
import { StaticGenerateHandler } from '@builder.io/qwik-city' | ||
import { Radio } from 'flowbite-qwik' | ||
|
||
export default component$(() => { | ||
const pick = useSignal<string>('blue') | ||
|
||
return ( | ||
<> | ||
<h2 class="text-xl font-semibold">Picked color : {pick.value}</h2> | ||
<div class="p-3 flex flex-col gap-3"> | ||
<Radio name="radio" value="blue" bind:option={pick}> | ||
Blue | ||
</Radio> | ||
<Radio name="radio" value="purple" color="purple" bind:option={pick}> | ||
Purple | ||
</Radio> | ||
<Radio name="radio" value="red" color="red" bind:option={pick}> | ||
Red | ||
</Radio> | ||
<Radio name="radio" value="green" color="green" bind:option={pick}> | ||
Green | ||
</Radio> | ||
<Radio name="radio" value="pink" color="pink" bind:option={pick}> | ||
Pink | ||
</Radio> | ||
</div> | ||
</> | ||
) | ||
}) | ||
|
||
export const onStaticGenerate: StaticGenerateHandler = async () => { | ||
return staticGenerateHandler() | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/web/src/routes/examples/[theme-rtl]/radio/03-disabled/index@examples.tsx
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,30 @@ | ||
/** | ||
* title: Disabled | ||
* description: This example can be used for the disabled state of the radio component by applying the disabled attribute to the input element. | ||
*/ | ||
|
||
import { component$, useSignal } from '@builder.io/qwik' | ||
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout' | ||
import { StaticGenerateHandler } from '@builder.io/qwik-city' | ||
import { Radio } from 'flowbite-qwik' | ||
|
||
export default component$(() => { | ||
const pick = useSignal<string>('') | ||
|
||
return ( | ||
<> | ||
<div class="p-3 flex flex-col gap-3"> | ||
<Radio name="radio" value="one" disabled bind:option={pick}> | ||
First option | ||
</Radio> | ||
<Radio name="radio" value="two" disabled bind:option={pick}> | ||
Second option | ||
</Radio> | ||
</div> | ||
</> | ||
) | ||
}) | ||
|
||
export const onStaticGenerate: StaticGenerateHandler = async () => { | ||
return staticGenerateHandler() | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/web/src/routes/examples/[theme-rtl]/select/01-default/index@examples.tsx
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,30 @@ | ||
/** | ||
* title: Default | ||
* description: Get started with the default example of a select input component to get a single option selection. | ||
*/ | ||
|
||
import { component$, useSignal } from '@builder.io/qwik' | ||
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout' | ||
import { StaticGenerateHandler } from '@builder.io/qwik-city' | ||
import { Select } from 'flowbite-qwik' | ||
|
||
export default component$(() => { | ||
const selected = useSignal('') | ||
const countries = [ | ||
{ value: 'us', name: 'United States' }, | ||
{ value: 'ca', name: 'Canada' }, | ||
{ value: 'fr', name: 'France' }, | ||
] | ||
|
||
return ( | ||
<> | ||
<div class="p-3 flex flex-col gap-3"> | ||
<Select bind:value={selected} options={countries} placeholder="Choose a country" label="Select an option" /> | ||
</div> | ||
</> | ||
) | ||
}) | ||
|
||
export const onStaticGenerate: StaticGenerateHandler = async () => { | ||
return staticGenerateHandler() | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/web/src/routes/examples/[theme-rtl]/select/02-disabled/index@examples.tsx
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,30 @@ | ||
/** | ||
* title: Disabled | ||
* description: Apply the disable state to the select component to disallow the selection of new options. | ||
*/ | ||
|
||
import { component$, useSignal } from '@builder.io/qwik' | ||
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout' | ||
import { StaticGenerateHandler } from '@builder.io/qwik-city' | ||
import { Select } from 'flowbite-qwik' | ||
|
||
export default component$(() => { | ||
const selected = useSignal('') | ||
const countries = [ | ||
{ value: 'us', name: 'United States' }, | ||
{ value: 'ca', name: 'Canada' }, | ||
{ value: 'fr', name: 'France' }, | ||
] | ||
|
||
return ( | ||
<> | ||
<div class="p-3 flex flex-col gap-3"> | ||
<Select bind:value={selected} disabled options={countries} placeholder="Choose a country" label="Select an option" /> | ||
</div> | ||
</> | ||
) | ||
}) | ||
|
||
export const onStaticGenerate: StaticGenerateHandler = async () => { | ||
return staticGenerateHandler() | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/web/src/routes/examples/[theme-rtl]/select/03-selected/index@examples.tsx
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,30 @@ | ||
/** | ||
* title: Selected option | ||
* description: Use this example to get a single option selection with the selected state of the select input component. | ||
*/ | ||
|
||
import { component$, useSignal } from '@builder.io/qwik' | ||
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout' | ||
import { StaticGenerateHandler } from '@builder.io/qwik-city' | ||
import { Select } from 'flowbite-qwik' | ||
|
||
export default component$(() => { | ||
const selected = useSignal('fr') | ||
const countries = [ | ||
{ value: 'us', name: 'United States' }, | ||
{ value: 'ca', name: 'Canada' }, | ||
{ value: 'fr', name: 'France' }, | ||
] | ||
|
||
return ( | ||
<> | ||
<div class="p-3 flex flex-col gap-3"> | ||
<Select bind:value={selected} options={countries} placeholder="Choose a country" label="Select an option" /> | ||
</div> | ||
</> | ||
) | ||
}) | ||
|
||
export const onStaticGenerate: StaticGenerateHandler = async () => { | ||
return staticGenerateHandler() | ||
} |
32 changes: 32 additions & 0 deletions
32
apps/web/src/routes/examples/[theme-rtl]/select/04-sizes/index@examples.tsx
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,32 @@ | ||
/** | ||
* title: Sizes | ||
* description: Get started with the small, default, and large sizes for the select component from the example below. | ||
*/ | ||
|
||
import { component$, useSignal } from '@builder.io/qwik' | ||
import { staticGenerateHandler } from '~/routes/examples/[theme-rtl]/layout' | ||
import { StaticGenerateHandler } from '@builder.io/qwik-city' | ||
import { Select } from 'flowbite-qwik' | ||
|
||
export default component$(() => { | ||
const selected = useSignal('') | ||
const countries = [ | ||
{ value: 'us', name: 'United States' }, | ||
{ value: 'ca', name: 'Canada' }, | ||
{ value: 'fr', name: 'France' }, | ||
] | ||
|
||
return ( | ||
<> | ||
<div class="p-3 flex flex-col gap-3"> | ||
<Select bind:value={selected} options={countries} placeholder="Choose a country" label="Small" size="sm" /> | ||
<Select bind:value={selected} options={countries} placeholder="Choose a country" label="Medium" size="md" /> | ||
<Select bind:value={selected} options={countries} placeholder="Choose a country" label="Large" size="lg" /> | ||
</div> | ||
</> | ||
) | ||
}) | ||
|
||
export const onStaticGenerate: StaticGenerateHandler = async () => { | ||
return staticGenerateHandler() | ||
} |
Oops, something went wrong.