mirror of https://github.com/Budibase/budibase.git
9 changed files with 85 additions and 45 deletions
@ -0,0 +1,17 @@ |
|||
<script> |
|||
import { getContext, setContext } from "svelte" |
|||
|
|||
export let labelPosition = "above" |
|||
|
|||
const { styleable } = getContext("sdk") |
|||
const component = getContext("component") |
|||
setContext("fieldGroup", { labelPosition }) |
|||
</script> |
|||
|
|||
<div use:styleable={$component.styles}> |
|||
<form |
|||
class="spectrum-Form" |
|||
class:spectrum-Form--labelsAbove={labelPosition === 'above'}> |
|||
<slot /> |
|||
</form> |
|||
</div> |
|||
@ -0,0 +1,14 @@ |
|||
<script> |
|||
import { getContext } from "svelte" |
|||
|
|||
const fieldGroupContext = getContext("fieldGroup") |
|||
const labelPosition = fieldGroupContext?.labelPosition || "above" |
|||
</script> |
|||
|
|||
{#if fieldGroupContext} |
|||
<slot /> |
|||
{:else} |
|||
<div class="spectrum-Form--labelsAbove"> |
|||
<slot /> |
|||
</div> |
|||
{/if} |
|||
@ -1,4 +1,5 @@ |
|||
export { default as form } from "./Form.svelte" |
|||
export { default as fieldgroup } from "./FieldGroup.svelte" |
|||
export { default as stringfield } from "./StringField.svelte" |
|||
export { default as numberfield } from "./NumberField.svelte" |
|||
export { default as optionsfield } from "./OptionsField.svelte" |
|||
|
|||
Loading…
Reference in new issue