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
49 changes: 49 additions & 0 deletions examples/official-site/content/components/alert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
icon: alert-triangle
category: forms-and-feedback
summary: Draw attention to a message with a color and an icon.
top:
- class
- name: color
type: COLOR
description: The color theme for the alert message.
- name: description
type: TEXT
description: Detailed description or content of the alert message.
- name: description_md
type: TEXT
description: Detailed description or content of the alert message, in Markdown format, allowing you to
use rich text formatting, including `**bold**` and `*italic*` text.
- name: dismissible
type: BOOLEAN
description: Whether the user can close the alert message.
- name: icon
type: TEXT
description: Icon name (from tabler-icons.io) to display next to the alert message.
- id
- name: important
type: BOOLEAN
description: Set this to TRUE to make the alert message more prominent.
- name: link
type: URL
description: A URL to link to from the alert message.
- name: link_text
type: TEXT
description: Customize the text of the link in the alert message. The default is "Ok".
- name: title
type: TEXT
required: true
description: Title of the alert message.
row:
- name: color
type: COLOR
description: Customize the color of the link.
- name: link
type: URL
description: A URL to link to from the alert message.
- name: title
type: TEXT
description: Customize the text of the link in the alert message. The default is "Ok".
---

A visually distinctive message or notification.
55 changes: 55 additions & 0 deletions examples/official-site/content/components/authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
icon: lock
since: 0.7.2
category: server-logic
summary: Restrict access by checking a password against a stored hash.
top:
- name: link
type: TEXT
description: The URL to redirect the user to if they are not logged in. If this parameter is not specified,
the user will stay on the current page, but be asked to log in using a popup in their browser (HTTP basic
authentication).
- name: password
type: TEXT
description: The password that was sent by the user. You can set this to :password if you have a login
form leading to your page.
- name: password_hash
type: TEXT
description: The hash of the password that you stored for the user that is currently trying to log in.
These hashes can be generated ahead of time using a tool like https://argon2.online/.
---

Create pages with password-restricted access.


When you want to add user authentication to your SQLPage application,
you have two main options:

1. The `authentication` component:
- lets you manage usernames and passwords yourself
- does not require any external service
- gives you fine-grained control over
- which pages and actions are protected
- the look of the [login form](?component=login)
- the duration of the session
- the permissions of each user
2. [**Single sign-on**](/sso)
- lets users log in with their existing accounts (like Google, Microsoft, or your organization's own identity provider)
- requires setting up an external service (Google, Microsoft, etc.)
- frees you from implementing a lot of features like password reset, account creation, user management, etc.

This page describes the first option.

When used, this component has to be at the top of your page,
because once the page has begun being sent to the browser,
it is too late to restrict access to it.

The authentication component checks if the user has sent the correct password,
and if not, redirects them to the URL specified in the link parameter.

If you don't want to re-check the password on every page (which is an expensive operation),
you can check the password only once and store a session token in your database
(see the session example below).

You can use the [cookie component](?component=cookie) to set the session token cookie in the client browser,
and then check whether the token matches what you stored in subsequent pages.
61 changes: 61 additions & 0 deletions examples/official-site/content/components/big_number.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
icon: chart-area
since: 0.28.0
category: display-data
summary: Highlight a metric with a trend or progress indicator.
top:
- class
- name: columns
type: INTEGER
description: The number of columns to display the big numbers in (default is one column per item).
- id
- name: wrap
type: BOOLEAN
description: Wrap long titles and descriptions onto multiple lines. By default, they are truncated with
an ellipsis.
row:
- name: change_percent
type: INTEGER
description: The percentage change in value (e.g., 7 for 7% increase, -8 for 8% decrease).
- class
- name: color
type: COLOR
description: The color of the card background and its main value.
- name: description
type: TEXT
description: A description or additional context for the big number.
- name: dropdown_item
type: JSON
description: A list of JSON objects containing links. e.g. {"label":"This week", "link":"?days=7"}
- id
- name: progress_color
type: TEXT
description: The color of the progress bar (e.g., "primary", "success", "danger").
- name: progress_percent
type: INTEGER
description: The value of the progress (0-100).
- name: title
type: TEXT
description: The title or label for the big number.
- name: title_link
type: TEXT
description: A link for the Big Number title. If set, the entire title becomes clickable.
- name: title_link_new_tab
type: BOOLEAN
description: If true, the title link will open in a new tab/window.
- name: unit
type: TEXT
description: The unit of measurement for the value.
- name: value
type: TEXT
required: true
description: The main value to be displayed prominently.
- name: value_link
type: TEXT
description: A link for the Big Number value. If set, the entire value becomes clickable.
- name: value_link_new_tab
type: BOOLEAN
description: If true, the value link will open in a new tab/window.
---

A component to display key metrics or statistics with optional description, change indicator, and progress bar. Useful in dashboards.
26 changes: 26 additions & 0 deletions examples/official-site/content/components/breadcrumb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
icon: dots
since: 0.18.0
category: navigation
summary: Link the current page to its parent pages.
top:
- class
- id
row:
- name: active
type: TEXT
description: Whether the link is active or not. Defaults to false.
- name: description
type: TEXT
description: Description of the link. This is displayed when the user hovers over the link.
- name: link
type: TEXT
description: Link to the page to display when the link is clicked. By default, the link refers to the current
page, with a 'link' parameter set to the link's title.
- name: title
type: TEXT
required: true
description: Hyperlink text to display.
---

A secondary navigation aid that helps users understand their location on a website or mobile application.
78 changes: 78 additions & 0 deletions examples/official-site/content/components/button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
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: 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.
123 changes: 123 additions & 0 deletions examples/official-site/content/components/card.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
icon: credit-card
category: display-data
summary: Arrange records in cards with images, links, or embedded content.
top:
- class
- name: columns
type: INTEGER
description: The number of columns in the grid of cards. This is just a hint, the grid will adjust dynamically
to the user's screen size, rendering fewer columns if needed to fit the contents. To control the size
of cards individually, use the `width` row-level property instead.
- name: description
type: TEXT
description: A short paragraph displayed below the title.
- name: description_md
type: TEXT
description: A short paragraph displayed below the title - formatted using markdown.
- name: title
type: TEXT
description: Text header at the top of the list of cards.
row:
- name: active
type: BOOLEAN
description: Whether this item in the grid is considered "active". Active items are displayed more prominently.
- name: allow
type: TEXT
description: The permissions policy of the iframe embed code, for instance "fullscreen; clipboard-write".
Used only when embed_mode is 'iframe'.
- name: background_color
type: COLOR
description: The background color of the card.
- class
- name: color
type: COLOR
description: The name of a color, to be displayed on the left of the card to highlight it. If the embed
parameter is enabled and you don't have a title or description, this parameter won't apply.
- name: description
type: TEXT
description: |-
The body of the card, where you put the main text contents of the card.
This does not support rich text formatting, only plain text.
If you want to use rich text formatting, use the `description_md` property instead.
- name: description_md
type: TEXT
description: |2-

The body of the card, in Markdown format.
This is useful if you want to display a lot of text in the card, with many options for formatting, such as
line breaks, **bold**, *italics*, lists, #titles, [links](target.sql), ![images](photo.jpg), etc.
- name: embed
type: TEXT
description: |-
A url whose contents will be fetched and injected into the body of this card.
This can be used to inject arbitrary html content, but is especially useful for injecting
the output of other sql files rendered by SQLPage. For the latter case you can pass the
`?_sqlpage_embed` query parameter, which will skip the shell layout.
Components inside the fetched content initialize automatically. Custom scripts that insert
SQLPage fragments should dispatch a bubbling `fragment-loaded` event on the element containing
the new content. Initialization includes that element and its descendants; dispatching the
event on `document` initializes pending components throughout the page. Repeated events
preserve existing form and widget handlers
- name: embed_mode
type: TEXT
description: |-
Set to 'iframe' to embed the target (specified through embed property) in an iframe.
Unless this is explicitly set, the embed target is fetched and injected within the parent page. If embed_mode is set to iframe,
You can also set height and width parameters to configure the appearance and the sandbox and allow parameters to configure
security aspects of the iframe. Refer to the [MDN page](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)
for an explanation of these parameters.
- name: footer
type: TEXT
description: Muted text to display at the bottom of the card.
- name: footer_link
type: URL
description: An URL to which the user should be taken when they click on the footer.
- name: footer_md
type: TEXT
description: Muted text to display at the bottom of the card, with rich text formatting in Markdown format.
- name: height
type: INTEGER
description: Height of the iframe embed code, in pixels. Used only when embed_mode is 'iframe'.
- name: icon
type: ICON
description: Name of an icon to display on the right side of the card.
- id
- name: link
type: URL
description: An URL to which the user should be taken when they click on the card.
- name: sandbox
type: TEXT
description: The restrictions to apply to the iframe embed code, for instance "allow-scripts allow-same-origin".
Used only when embed_mode is 'iframe'.
- name: style
type: TEXT
description: 'Inline style property to your iframe embed code. For example "background-color: #FFFFFF"'
- name: target
type: TEXT
description: 'Where the card''s link opens: "_blank" for a new tab, "_self" for the same tab, "_parent"
for the parent frame, or "_top" for the full body of the window.'
- name: title
type: TEXT
required: true
description: Name of the card, displayed at the top.
- name: top_image
type: URL
description: The URL (absolute or relative) of an image to display at the top of the card.
- name: top_image_height
type: INTEGER
description: Specify the top image height, in pixels. Helps prevent layout shifts.
- name: top_image_lazy
type: BOOLEAN
description: Whether the top image must be lazily loaded. Defaults to false, meaning eagerly loaded.
- name: top_image_width
type: INTEGER
description: Specify the top image width, in pixels. Helps prevent layout shifts.
- name: width
type: INTEGER
description: The width of the card, between 1 (smallest) and 12 (full-width). The default width is 3, resulting
in 4 cards per line. When embed_mode is 'iframe', this is used as the width of the iframe instead, and
defaults to 100%.
---

A grid where each element is a small card that displays a piece of data.
Loading
Loading