App & Dashboard appdashboardsaaslawlegalheadingactions
Law Portal Heading
Page heading for the client portal with kicker, description, back link and action buttons.
Live Preview
Resumen
Usage
Copy and paste this code into your Astro page:
astro
---
import { LawPortalHeading } from 'astro-component-kit/app';
---
<LawPortalHeading kicker="Mi portal" title="Expedientes" back={{ label: 'Resumen', href: '/portal' }} /> ---
import { LawPortalHeading } from 'astro-component-kit/app';
---
<LawPortalHeading kicker="Mi portal" title="Expedientes" back={{ label: 'Resumen', href: '/portal' }} /> Examples in context
Real code from the kit: how this piece is used inside templates, sections and other components.
LawCasesPage.astro astro
<LawPortalHeading
kicker="Mi portal"
title="Expedientes"
description="El estado de cada asunto, con su cronología y el siguiente paso."
back={{ label: 'Resumen', href: routes.dashboard }}
/> <LawPortalHeading
kicker="Mi portal"
title="Expedientes"
description="El estado de cada asunto, con su cronología y el siguiente paso."
back={{ label: 'Resumen', href: routes.dashboard }}
/> Used in
Templates
Manual Installation
If you are not using the npm package, create a new file and paste the following code: src/components/lib/LawPortalHeading.astro:
astro
---
/**
* LawPortalHeading — Page heading for the client portal: kicker, serif title,
* description, optional back link and action buttons.
*
* @param {string} title - Page title (renders the page's h1).
* @param {string} kicker - Small label above the title.
* @param {string} description - Supporting text.
* @param {{label: string, href: string}} back - Optional back link.
* @param {Array<{label: string, href: string, primary?: boolean}>} actions - Buttons on the right.
* @param {string} class - Extra class for the root.
*
* Accessibility: single h1; back link has an arrow marked aria-hidden; buttons are 44px tall links.
*/
import type { HTMLAttributes } from 'astro/types';
import '../templates/law-firm/law-theme.css';
interface OwnProps {
title?: string;
kicker?: string;
description?: string;
back?: { label: string; href: string };
actions?: Array<{ label: string; href: string; primary?: boolean }>;
}
type Props = OwnProps & Omit<HTMLAttributes<'header'>, keyof OwnProps | 'class'> & { class?: string };
const { title = 'Resumen', kicker, description, back, actions = [], class: classAttr, ...rest } = Astro.props;
---
<header class:list={['law-ui', 'law-heading', classAttr]} {...rest}>
<div class="law-heading__text">
{back && <a class="law-heading__back" href={back.href}><span aria-hidden="true">←</span> {back.label}</a>}
{kicker && <p class="law-heading__kicker">{kicker}</p>}
<h1 class="law-heading__title">{title}</h1>
{description && <p class="law-heading__desc">{description}</p>}
</div>
{actions.length > 0 && (
<div class="law-heading__actions">
{actions.map((a) => <a href={a.href} class:list={['law-heading__btn', a.primary && 'is-primary']}>{a.label}</a>)}
</div>
)}
</header>
<style>
.law-heading {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
gap: var(--sp-4, 1rem);
color: var(--lw-text);
font-family: var(--lw-font-body);
}
.law-heading__back {
display: inline-flex;
align-items: center;
gap: 6px;
min-height: 44px;
color: var(--lw-text-2);
font-size: 0.9rem;
text-decoration: none;
}
.law-heading__back:hover {
color: var(--lw-brand);
}
.law-heading__kicker {
margin: 0 0 var(--sp-1, 0.25rem);
color: var(--lw-brand);
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.law-heading__title {
margin: 0;
font-family: var(--lw-font-display);
font-weight: 600;
font-size: clamp(1.9rem, 4vw, 2.8rem);
line-height: 1.05;
letter-spacing: -0.01em;
}
.law-heading__desc {
margin: var(--sp-2, 0.5rem) 0 0;
color: var(--lw-text-2);
}
.law-heading__actions {
display: flex;
flex-wrap: wrap;
gap: var(--sp-2, 0.5rem);
}
.law-heading__btn {
display: inline-flex;
align-items: center;
min-height: 44px;
padding: 0 var(--sp-5, 1.25rem);
border: 1px solid var(--lw-border-strong);
border-radius: var(--r-full, 999px);
color: var(--lw-text);
font-weight: 700;
text-decoration: none;
transition: background 0.2s ease, border-color 0.2s ease;
}
.law-heading__btn:hover {
border-color: var(--lw-brand);
}
.law-heading__btn.is-primary {
border-color: var(--lw-brand);
background: var(--lw-brand);
color: var(--lw-on-brand);
}
.law-heading__btn.is-primary:hover {
background: var(--lw-brand-hover);
}
.law-heading__btn:focus-visible,
.law-heading__back:focus-visible {
outline: 2px solid var(--lw-brand);
outline-offset: 2px;
}
</style> ---
/**
* LawPortalHeading — Page heading for the client portal: kicker, serif title,
* description, optional back link and action buttons.
*
* @param {string} title - Page title (renders the page's h1).
* @param {string} kicker - Small label above the title.
* @param {string} description - Supporting text.
* @param {{label: string, href: string}} back - Optional back link.
* @param {Array<{label: string, href: string, primary?: boolean}>} actions - Buttons on the right.
* @param {string} class - Extra class for the root.
*
* Accessibility: single h1; back link has an arrow marked aria-hidden; buttons are 44px tall links.
*/
import type { HTMLAttributes } from 'astro/types';
import '../templates/law-firm/law-theme.css';
interface OwnProps {
title?: string;
kicker?: string;
description?: string;
back?: { label: string; href: string };
actions?: Array<{ label: string; href: string; primary?: boolean }>;
}
type Props = OwnProps & Omit<HTMLAttributes<'header'>, keyof OwnProps | 'class'> & { class?: string };
const { title = 'Resumen', kicker, description, back, actions = [], class: classAttr, ...rest } = Astro.props;
---
<header class:list={['law-ui', 'law-heading', classAttr]} {...rest}>
<div class="law-heading__text">
{back && <a class="law-heading__back" href={back.href}><span aria-hidden="true">←</span> {back.label}</a>}
{kicker && <p class="law-heading__kicker">{kicker}</p>}
<h1 class="law-heading__title">{title}</h1>
{description && <p class="law-heading__desc">{description}</p>}
</div>
{actions.length > 0 && (
<div class="law-heading__actions">
{actions.map((a) => <a href={a.href} class:list={['law-heading__btn', a.primary && 'is-primary']}>{a.label}</a>)}
</div>
)}
</header>
<style>
.law-heading {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
gap: var(--sp-4, 1rem);
color: var(--lw-text);
font-family: var(--lw-font-body);
}
.law-heading__back {
display: inline-flex;
align-items: center;
gap: 6px;
min-height: 44px;
color: var(--lw-text-2);
font-size: 0.9rem;
text-decoration: none;
}
.law-heading__back:hover {
color: var(--lw-brand);
}
.law-heading__kicker {
margin: 0 0 var(--sp-1, 0.25rem);
color: var(--lw-brand);
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.law-heading__title {
margin: 0;
font-family: var(--lw-font-display);
font-weight: 600;
font-size: clamp(1.9rem, 4vw, 2.8rem);
line-height: 1.05;
letter-spacing: -0.01em;
}
.law-heading__desc {
margin: var(--sp-2, 0.5rem) 0 0;
color: var(--lw-text-2);
}
.law-heading__actions {
display: flex;
flex-wrap: wrap;
gap: var(--sp-2, 0.5rem);
}
.law-heading__btn {
display: inline-flex;
align-items: center;
min-height: 44px;
padding: 0 var(--sp-5, 1.25rem);
border: 1px solid var(--lw-border-strong);
border-radius: var(--r-full, 999px);
color: var(--lw-text);
font-weight: 700;
text-decoration: none;
transition: background 0.2s ease, border-color 0.2s ease;
}
.law-heading__btn:hover {
border-color: var(--lw-brand);
}
.law-heading__btn.is-primary {
border-color: var(--lw-brand);
background: var(--lw-brand);
color: var(--lw-on-brand);
}
.law-heading__btn.is-primary:hover {
background: var(--lw-brand-hover);
}
.law-heading__btn:focus-visible,
.law-heading__back:focus-visible {
outline: 2px solid var(--lw-brand);
outline-offset: 2px;
}
</style>
Quick Info
- Category
- App & Dashboard
- Filename
LawPortalHeading.astro- Dependencies
- None — pure Astro + CSS
- Tags
- appdashboardsaaslawlegalheadingactions