diff --git a/docs/assets/main.scss b/docs/assets/main.scss index 60f0408ae..a4c9f877b 100644 --- a/docs/assets/main.scss +++ b/docs/assets/main.scss @@ -16,7 +16,6 @@ code { padding-left: 0.25em; font-family: 'Source Code Pro', monospace; font-weight: 400; - white-space: nowrap; background-color: #918caf24; border-radius: 0.25em; } diff --git a/docs/pages/kcard.vue b/docs/pages/kcard.vue index 889979dee..0e1dcef4e 100644 --- a/docs/pages/kcard.vue +++ b/docs/pages/kcard.vue @@ -7,7 +7,11 @@
It manages the layout, including the thumbnail image, title, and other content. It offers several base layouts and many customization options. Cards like the examples shown can be created, and many others.
KCard
has two orientations: horizontal and vertical. It is also possible to configure whether a thumbnail area is displayed, its size and alignment. By combining orientation
, thumbnailDisplay
and thumbnailAlign
props, the following card layouts can be achieved to organize diverse kinds of content:
aboveTitle
, belowTitle
, and footer
slots to add content to a card. KCard
will organize these areas according to its KCard
is set to display the thumbnail, the thumbnail area acts as a placeholder if the image is missing, fails to load, or is still loading. In such cases, a light gray background is shown in place of the image.
- Use the thumbnailPlaceholder
slot to add a placeholder element, such as an icon, to this area. Provide a placeholder element even if a thumbnail image is available. This serves as a progressive loading experience where the placeholder element is displayed until the image is loaded, and is particularly important on slower networks.
Use the thumbnailPlaceholder
slot to add a placeholder element, such as an icon, to this area. Provide a placeholder element even if a thumbnail image is available. It serves as fallback content if the image fails to load unexpectedly.
ariaLabel
is applied to the bookmark icon button in the following example so that screenreaders can communicate its purpose. In production, more work would be needed to indicate the bookmark's toggled state. Always assess on a case-by-case basis.
KCard
's responsibility.
Displays a grid of cards
KCardGrid
provides base layouts for the most common grids in our ecosystem, as well as advanced configuration via useKCardGrid
(TBD), allowing customization or complete override of the base layouts.
KCardGrid
provides base layouts for the most common grids in our ecosystem, as well as customization or complete override of the base layouts.
Together with KCard
, it ensures accessible navigation within card lists, such as announcing only their titles when using the tab key to avoid overwhelming screen reader outputs.
Also follow
Base layouts can be customized or even completely overriden. Refer to useKCardGrid
(TBD).
Base layouts can be customized or even completely overriden via the layoutOverride
prop. layoutOverride
takes an array of objects { breakpoints, cardsPerRow, columnGap, rowGap }
, where:
breakpoints
is an array of 0-7
values corresponding to the cardsPerRow
overrides the number of cards per row for the specified breakpoints.columnGap
/rowGap
overrides grid column/row gaps for the specified breakpoints.For example:
+ +Here, the base 1-2-3
layout is overriden partially. Column and row gaps are decreased to 20px
on breakpoints 0-1
, and the number of cards per row is increased to 4 on breakpoints 4-7
.
Setting height on cards is discouraged. Instead, manage height bottom-up, for example by setting height on card sections, using text truncation, or other ways to limit its inner content. Such approaches ensure content tolerance, prevent from unexpected overflows or excessive height, and keep vertical alignment of card sections consistent on a grid row. This is especially important when dealing with unknown lenghts or amounts of content displayed in cards. Consider:
-KCard
's settings to further improve responsive experience. A common pattern is switching KCard
's horizontal orientation to vertical for smaller screens to organize content more effectively in limited space:
KCard
slots content. In the following example, some metadata pills are hidden on smaller screens:
When cards are loading, KCardGrid
displays skeleton cards...(TBD)
While data is loading, KCardGrid
shows loading skeleton cards. Use the loading
prop to toggle the loading state. Note that KCardGrid
internal optimizations may affect how closely the visual loading experience matches the loading
value:
Use the buttons in the example below to preview.
+ +By default, the number of loading skeletons corresponds to the number of cards in a single grid row if it were full. This behavior can be overridden via the count
attribute (below), however do not override it unless indicated in the designs.
Use the skeletonsConfig
prop to configure skeleton cards to match the expected visual output of loaded cards on all screen sizes. Preview the layout and height of cards with loaded data and adjust skeletonsConfig
accordingly.
skeletonsConfig
takes an array of objects { breakpoints, count, height, orientation, thumbnailDisplay, thumbnailAlign }
, where:
breakpoints
is an array of 0-7
values corresponding to the count
sets the number of skeleton cards for the specified breakpoints. See height
sets the height of skeleton cards for the specified breakpoints.orientation
sets the orientation of skeleton cards for the specified breakpoints. Corresponds to thumbnailDisplay
sets the thumbnail display of skeleton cards for the specified breakpoints. Corresponds to thumbnailAlign
sets the thumbnail alignment of skeleton cards for the specified breakpoints. Corresponds to For easier development, enable the debug
prop to display the current breakpoint in the top left corner of the grid. Use the button in the example below to preview the debug mode.
Here, the height of loading skeleton cards is 400px
with vertical orientation on breakpoints 0-3
, and 220px
with horizontal orientation on breakpoints 4-7
. This makes skeleton cards resemble loaded cards at all breakpoints, creating a smooth transition for users during data loading. Note the bottom-up approach where we begin with a base setup for all breakpoints and gradually override on higher breakpoints. This simplifies the configuration object.
To get a sense of what skeleton layouts can be achieved, reload this page and the KCard
page to preview the loading state in all examples.