Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions examples/official-site/content/components/button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
icon: hand-click
since: 0.14.0
category: forms-and-feedback
summary: Follow a link, download a file, or submit a form.
top:
- class
- name: justify
type: TEXT
description: The horizontal alignment of the button list (e.g., start, end, center, between).
- name: shape
type: TEXT
description: Shape of the buttons (e.g., pill, square)
- name: size
type: TEXT
description: The size of the buttons (e.g., sm, lg).
row:
- name: color
type: COLOR
description: The color of the button (e.g., red, green, blue, but also primary, warning, danger, etc.).
Only base color names are supported, not variations like "blue-lt" or "gray-300". Use a custom CSS stylesheet
to further customize the colors.
- name: disabled
type: BOOLEAN
description: Whether the button is disabled or not.
- name: download
type: TEXT
description: If defined, the link will download the target instead of navigating to it. Set the value to
the desired name of the downloaded file.
- name: form
type: TEXT
description: Identifier (id) of the form to which the button should submit.
- name: icon
type: ICON
description: Name of an icon to be displayed on the left side of the button.
- name: icon_after
type: ICON
description: Name of an icon to display after the text in the button
- name: id
type: TEXT
description: HTML Identifier to add to the button element.
- name: image
type: TEXT
description: Path to image file (relative. relative to web root or URL) to be displayed on the button.
- name: image_alt
type: TEXT
description: Alternative text for an informative button image. Leave empty if decorative or repeated by the button title.
- name: link
type: URL
description: The URL to which the button should navigate when clicked. If the form attribute is specified,
then this overrides the page to which the form is submitted.
- name: modal
type: TEXT
description: Display the modal window corresponding to the specified ID.
- name: narrow
type: BOOLEAN
description: Whether to trim horizontal padding.
- name: outline
type: COLOR
description: Outline color of the button (e.g. red, purple, ...)
- name: rel
type: TEXT
description: '"nofollow" when the contents of the target link are not endorsed, "noopener" when the target
is not trusted, and "noreferrer" to hide where the user came from when they open the link.'
- name: space_after
type: BOOLEAN
description: Whether there should be extra space to the right of the button. In a line of buttons, this
will put the buttons before this one on the left, and the ones after on the right.
- name: target
type: TEXT
description: '"_blank" to open the link in a new tab, "_self" to open it in the same tab, "_parent" to
open it in the parent frame, or "_top" to open it in the full body of the window.'
- name: title
type: TEXT
description: The text displayed on the button.
- name: tooltip
type: TEXT
description: Text displayed when the user hovers over the button.
---

Displays one or more buttons that follow links, download files, or submit a form.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
rows:
- component: button
- link: /documentation.sql
title: Enabled
- link: '#'
title: Disabled
disabled: true
---

A basic button with a link
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
rows:
- component: button
size: sm
shape: pill
- title: Purple
outline: purple
- title: Orange
outline: orange
- title: Red
outline: red
---

A button with a custom shape, size, and outline color
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
rows:
- component: button
justify: center
- link: '#'
color: light
title: Light
- link: '#'
color: success
title: Success
- link: '#'
color: info
title: Info
- link: '#'
color: dark
title: Dark
- link: '#'
color: warning
title: Warning
- link: '#'
color: danger
title: Narrow
---

A list of buttons aligned in the center
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
rows:
- component: button
- link: '#'
narrow: true
icon: edit
color: primary
tooltip: Edit
- link: '#'
narrow: true
icon: trash
color: danger
tooltip: Delete
- link: '#'
narrow: true
icon: corner-down-right
color: info
tooltip: Preview
- link: '#'
narrow: true
icon: download
color: success
tooltip: Download
- link: '#'
narrow: true
icon: upload
color: warning
tooltip: Upload
- link: '#'
narrow: true
icon: info-circle
color: cyan
tooltip: Info
- link: '#'
narrow: true
icon: help-circle
color: purple
tooltip: Help
- link: '#'
narrow: true
icon: settings
color: indigo
tooltip: Settings
---

Icon buttons using the narrow property
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
rows:
- component: button
size: lg
- link: '#'
outline: azure
title: Edit
icon: edit
- link: '#'
outline: danger
title: Delete
icon: trash
---

Buttons with icons and different sizes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
rows:
- component: button
shape: square
- link: '#'
color: green
title: Save
icon: device-floppy
- link: '#'
title: Cancel
space_after: true
tooltip: This will delete your draft
- link: '#'
outline: indigo
title: Preview
icon_after: corner-down-right
tooltip: View temporary draft
---

A row of square buttons with spacing in between
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
rows:
- component: form
id: poem
validate: ''
- type: textarea
name: Poem
placeholder: Write a poem
- component: button
- link: ?action=save
form: poem
color: primary
title: Save
- link: ?action=preview
form: poem
outline: yellow
title: Preview
---

Multiple buttons sending the same form to different pages.

We use `'' AS validate` to remove the submit button from inside the form itself,
and instead use the button component to submit the form to pages with different GET variables.

In the target page, we could then use the GET variable `$action` to determine what to do with the form data.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
rows:
- component: button
- link: /sqlpage_introduction_video.mp4
title: Download Video
icon: download
download: Introduction Video.webm
rel: nofollow
---

A button that downloads a file when clicked, and prevents search engines from following the link.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
rows:
- component: button
- link: https://en.wikipedia.org/wiki/File:Globe.svg
title: Open an article
image: https://upload.wikimedia.org/wikipedia/commons/f/fa/Globe.svg
---

A button with an image-based icon.
67 changes: 67 additions & 0 deletions examples/official-site/content/components/modal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
icon: app-window
since: 0.36.0
category: forms-and-feedback
summary: Open a dialog over the page for details, forms, or media.
top:
- name: allow
type: TEXT
description: For embedded content, this attribute specifies the features or permissions that can be used.
- name: class
type: TEXT
description: Class attribute added to the container in HTML. It can be used to apply custom styling to
this item through css.
- name: close
type: TEXT
description: The text to display in the Close button.
- name: close_label
type: TEXT
description: The same as `close`. Use it on databases where `close` is a reserved word, such as SQL Server.
- name: embed
type: TEXT
description: Embed remote content in an iframe.
- name: embed_mode
type: TEXT
description: Use "iframe" to display embedded content within an iframe.
- name: height
type: INTEGER
description: Height of the modal content, in pixels. Overflow content scrolls.
- name: id
type: TEXT
required: true
description: ID attribute added to the container in HTML. It can be used to target this item through css
or for displaying this item.
- name: large
type: BOOLEAN
description: Indicates that the modal box has an increased width.
- name: sandbox
type: TEXT
description: For embedded content, this attribute specifies the security restrictions on the loaded content.
- name: scrollable
type: BOOLEAN
description: Create a scrollable modal that allows scroll the modal body.
- name: small
type: BOOLEAN
description: Indicates that the modal box has a reduced width.
- name: style
type: TEXT
description: Applies CSS styles to the embedded content.
- name: title
type: TEXT
required: true
description: Description of the modal box.
row:
- name: contents
type: TEXT
description: A paragraph of text to display, without any formatting, without having to make additional
queries.
- name: contents_md
type: TEXT
description: Rich text in the markdown format. Among others, this allows you to write bold text using `**bold**`,
italics using `*italics*`, and links using `[text](https://example.com)`.
---

Defines the a temporary popup box displayed on top of a webpage’s content.
Useful for displaying additional information, help, or collect data from users.

Modals are closed by default, and can be opened by clicking on a button or link targeting their ID.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
rows:
- component: modal
id: my_modal
title: A modal box
close: Close
- contents: I'm a modal window, and I allow you to display additional information or help for the user.
- component: button
- title: Open a simple modal
link: '#my_modal'
---

This example shows how to create a modal box that displays a paragraph of text. The modal window is opened with the help of a button.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
rows:
- component: modal
id: my_embed_form_modal
title: Embedded form
large: true
embed: /examples/form.sql
- component: button
- title: Open a modal with a form
link: '#my_embed_form_modal'
---

The button opens the dialog by its `id`. `embed` loads the form from another SQLPage file without its surrounding page shell.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
rows:
- component: modal
id: my_embed_chart_modal
title: Embeded chart content
close: Close
embed: /examples/chart.sql?_sqlpage_embed
- component: datagrid
- title: Chart
color: blue
description: Revenue
link: '#my_embed_chart_modal'
- title: Form
color: green
description: Fill info
link: '#my_embed_form_modal'
---

A popup modal that contains a chart generated by a separate SQL file. The modal is triggered by links inside a datagrid.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
rows:
- component: modal
id: my_embed_video_modal
title: Embeded video content
close: Close
embed: https://www.youtube.com/embed/mXdgmSdaXkg
allow: accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share
embed_mode: iframe
height: '350'
- component: text
contents_md: Open a [modal with a video](#my_embed_video_modal)
---

Example of modal video content
Loading
Loading