<c-login-card>
The card of a sign-in page: a large surface holding the service's heading, the sign-in form or choices and their actions, with an optional background image showing below a curved edge.
Usage
Build it from its sections, in this order: c-login-card-title for the heading, c-login-card-content for the intro text and the fields, and c-login-card-actions for the sign-in button and any links next to it.
<c-login-card src="/img/sign-in.jpg">
<c-login-card-title>Sign in to My CSC</c-login-card-title>
<c-login-card-content>
<p>Access your projects and services with your CSC account.</p>
<c-text-field label="Username"></c-text-field>
<c-text-field label="Password" type="password"></c-text-field>
</c-login-card-content>
<c-login-card-actions justify="space-between">
<c-button size="large">Sign in</c-button>
<c-link href="/reset-password">Forgot password?</c-link>
</c-login-card-actions>
</c-login-card>
When to use
- As the one card on a sign-in page.
- For grouping any other content, use
c-card.
Background image
src sets the image. On a wide card it fills the bottom-right corner below a curved edge, and the content column leaves room for it; background-position (any CSS background-position value, bottom right by default) chooses which part of the image shows. Without src there is no image and the content takes the card's full width.
overlay tints the image with the primary colour, blended through overlay-blend-mode — multiply by default, or any other CSS blend mode — so a photograph sits in the brand palette.
Compact layout
The card measures its own width, not the window's. At mobile-breakpoint pixels (600 by default) or narrower it switches to a compact layout: tighter padding, content across the full width, the image moved to a wave-shaped strip along the bottom edge, and the heading shrunk from 40px to 32px with hyphenation.
Accessibility
The image is a CSS background: it is never announced, so it must not carry information the page needs. c-login-card-title is a heading, level 2 unless its heading-level says otherwise.
Customization
::part(root) is the card's surface (background, ink and corner radius), ::part(card) the shadowed box inside it, ::part(image) the clipped image layer and ::part(content) the padded column holding the sections. Each section has parts of its own, listed with it below.
A login card that pins its own theme mode with data-theme="light" or data-theme="dark" repaints its surface and the ink of everything slotted into it.
<c-login-card-title>
The heading of a c-login-card, in large bold type in the primary colour; place it first in the card. The card shrinks it from 40px to 32px in its compact layout.
The title is a heading, level 2 unless heading-level says otherwise; on a sign-in page whose only other heading is the page's h1, keep 2.
Examples
<template>
<div>
<c-login-card :src="artwork" background-position="50% 0%">
<c-login-card-title>Sign in to My CSC</c-login-card-title>
<c-login-card-content>
<p>Access your projects and services with your CSC account.</p>
<c-text-field label="Username" name="username" />
<c-text-field label="Password" name="password" type="password" />
</c-login-card-content>
<c-login-card-actions justify="space-between">
<c-button size="large">Sign in</c-button>
<c-link href="https://csc.fi" underline>Forgot password?</c-link>
</c-login-card-actions>
</c-login-card>
</div>
</template>
<script setup lang="ts">
// Stand-in artwork; use your service's own image url as `src` instead.
const artwork = `data:image/svg+xml;utf8,${encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 800"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#006778"/><stop offset="1" stop-color="#1c3d5a"/></linearGradient></defs><rect width="600" height="800" fill="url(#g)"/><circle cx="470" cy="170" r="170" fill="#fff" fill-opacity=".14"/><circle cx="120" cy="660" r="230" fill="#fff" fill-opacity=".08"/></svg>',
)}`;
</script>
<template>
<div>
<c-login-card :src="artwork" overlay-blend-mode="multiply" overlay>
<c-login-card-title>Sign in to My CSC</c-login-card-title>
<c-login-card-content>
<p>Access your projects and services with your CSC account.</p>
<c-text-field label="Username" name="username" />
<c-text-field label="Password" name="password" type="password" />
</c-login-card-content>
<c-login-card-actions justify="space-between">
<c-button size="large">Sign in</c-button>
<c-link href="https://csc.fi" underline>Forgot password?</c-link>
</c-login-card-actions>
</c-login-card>
</div>
</template>
<script setup lang="ts">
// `overlay` tints the image with the primary colour through the chosen blend
// mode, so any photo sits in the brand palette. Stand-in artwork; use your
// service's own image url as `src` instead.
const artwork = `data:image/svg+xml;utf8,${encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 800"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#006778"/><stop offset="1" stop-color="#1c3d5a"/></linearGradient></defs><rect width="600" height="800" fill="url(#g)"/><circle cx="470" cy="170" r="170" fill="#fff" fill-opacity=".14"/><circle cx="120" cy="660" r="230" fill="#fff" fill-opacity=".08"/></svg>',
)}`;
</script>
<template>
<div>
<c-login-card>
<c-login-card-title>Sign in to My CSC</c-login-card-title>
<c-login-card-content>
<p>Access your projects and services with your CSC account.</p>
</c-login-card-content>
<c-login-card-actions>
<c-button>Sign in</c-button>
</c-login-card-actions>
</c-login-card>
</div>
</template>
<template>
<div>
<c-login-card>
<c-login-card-title>Sign in to My CSC</c-login-card-title>
<c-login-card-content>
<p>Access your projects and services with your CSC account.</p>
<c-text-field label="Username" name="username" />
<c-text-field label="Password" name="password" type="password" />
</c-login-card-content>
<c-login-card-actions>
<c-button>Sign in</c-button>
</c-login-card-actions>
</c-login-card>
</div>
</template>
<template>
<div>
<c-login-card>
<c-login-card-title>Sign in to My CSC</c-login-card-title>
<c-login-card-content>
<p>Access your projects and services with your CSC account.</p>
</c-login-card-content>
<c-login-card-actions justify="space-between">
<c-button size="large">Sign in</c-button>
<c-link href="https://csc.fi" underline>Forgot password?</c-link>
</c-login-card-actions>
</c-login-card>
</div>
</template>
API reference
<c-login-card>
The card of a sign-in page: a large surface holding the service's heading, the sign-in form or choices and their actions, with an optional background image showing below a curved edge.
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
backgroundPosition | background-position | string | 'bottom right' | Which part of the `src` image shows: any CSS `background-position` value. |
mobileBreakpoint | mobile-breakpoint | number | 600 | The card's own width, in pixels, at or below which it switches to its compact layout. |
overlay | overlay | boolean | false | Tints the background image with the primary colour, blended through `overlay-blend-mode`. |
overlayBlendMode | overlay-blend-mode | CLoginCardBlendMode | 'multiply' | How the `overlay` tint blends with the image: a CSS blend mode. |
src | src | string | '' | URL of the background image, shown below a curved edge: in the card's bottom-right corner, or along its bottom in the compact layout. Without it the content takes the card's full width. |
Slots
| Slot | Description |
|---|---|
default | The card's sections: `c-login-card-title`, `c-login-card-content` and `c-login-card-actions`, in that order |
CSS parts
Style from outside with c-login-card::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The card's surface, carrying its background, ink and corner radius |
card | The shadowed box inside the root |
image | The clipped background-image layer |
content | The padded column holding the sections |
Types
Importable from the package root: import type { … } from '@cscfi/csc-ui'
CLoginCardBlendMode
CSS `mix-blend-mode` applied to the primary-coloured overlay drawn over the background image when `overlay` is set.
export type CLoginCardBlendMode =
| 'color-burn'
| 'color-dodge'
| 'color'
| 'darken'
| 'difference'
| 'exclusion'
| 'hard-light'
| 'hue'
| 'lighten'
| 'luminosity'
| 'multiply'
| 'normal'
| 'overlay'
| 'saturation'
| 'screen'
| 'soft-light';<c-login-card-title>
The heading of a `c-login-card`, in large bold type in the primary colour; place it first in the card. The card shrinks it from 40px to 32px in its compact layout.
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
headingLevel | heading-level | 1 | 2 | 3 | 4 | 5 | 6 | 2 | The title's heading level, 1 to 6: pick the one that fits the card's place in the page's outline (2 under the page's `h1`, 3 inside a section with an `h2`). |
Slots
| Slot | Description |
|---|---|
default | The title text |
CSS parts
Style from outside with c-login-card-title::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The heading (`role="heading"`, at `heading-level`) carrying the heading typography |
<c-login-card-content>
The body of a `c-login-card`, which stacks the intro text and the sign-in fields in a column with a 24px gap. Place it between `c-login-card-title` and `c-login-card-actions`.
Slots
| Slot | Description |
|---|---|
default | The intro text and the sign-in fields |
CSS parts
Style from outside with c-login-card-content::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The column stacking the slotted content with a 24px gap |
<c-login-card-actions>
The row of actions at the bottom of a `c-login-card`: the sign-in button and any link beside it, such as a forgotten-password link. `justify` distributes them along the row (`start` by default, `space-between` to push the last one to the far end, `stretch` to grow them all) and `align` places them across it.
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
align | align | CLoginCardActionsAlign | 'center' | Aligns the actions across the row: to its top (`start`), centre or bottom (`end`). |
justify | justify | CLoginCardActionsJustify | 'start' | Distributes the actions along the row; `stretch` grows every action to share it. |
Slots
| Slot | Description |
|---|---|
default | The actions: the sign-in button and any link beside it |
CSS parts
Style from outside with c-login-card-actions::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The outer footer element |
actions | The flex row laying out the slotted actions |
Types
Importable from the package root: import type { … } from '@cscfi/csc-ui'
CLoginCardActionsAlign
Cross-axis alignment of the slotted actions within the row.
export type CLoginCardActionsAlign = 'center' | 'end' | 'start';CLoginCardActionsJustify
Main-axis distribution of the slotted actions. `stretch` makes every action grow to fill the row.
export type CLoginCardActionsJustify =
| 'center'
| 'end'
| 'space-around'
| 'space-between'
| 'start'
| 'stretch';