부품 첫 화면

하위 페이지 머리 page-hero

하위 페이지 맨 위. 사진 띠 위에 영문 한 줄과 페이지 제목, 그 아래 줄에 빵 부스러기(홈 / 현재 위치)와 페이지 안 탭을 둔다.

  • 나온 곳 한결정밀
  • 서브 비주얼
  • 페이지 제목
  • 빵 부스러기
  • 브레드크럼
  • 탭

설치

shadcn/ui 를 쓰는 Next.js 프로젝트에서 한 줄로 설치됩니다. 파일은 components/bpublish/page-hero.tsx 로 들어오고, 공통 토큰(base)도 같이 설치됩니다. 테마는 테마에서 하나 고릅니다.

npx shadcn@latest add https://www.bpublish.com/r/page-hero.json

레지스트리를 등록했다면 npx shadcn@latest add @bpublish/page-hero · 설치 안내

AI에게 맡기기

Claude Code, Cursor 같은 AI 코딩 도구에 붙여 넣으세요. MCP 서버를 연결해 두면 이름만 말해도 됩니다.

bpublish UI의 하위 페이지 머리(page-hero) 부품으로 만들어 줘. 설치: npx shadcn@latest add https://www.bpublish.com/r/page-hero.json · 문서: https://www.bpublish.com/designs/components/page-hero

사용 예시

app/page.tsx
import { PageHero } from '@/components/bpublish/page-hero'

export default function Example() {
  return (
    <PageHero
      image={'/images/company-hero.webp'}
      eyebrow="About Us"
      title="회사소개"
      crumbs={[{ label: '회사소개', href: '/company' }, { label: '연혁' }]}
      tabs={[
        { label: '인사말', href: '#greeting' },
        { label: '연혁', href: '#history' },
        { label: '품질·인증', href: '#quality' },
        { label: '설비', href: '#equipment' },
        { label: '오시는 길', href: '#location' },
      ]}
      current="#history"
    />
  )
}

속성

이름형식기본값설명
title필수string—페이지 제목
eyebrowstring—제목 위 영문 한 줄
image필수string—사진 띠 주소
imageAltstring''사진 설명
crumbs{ label: string; href?: string }[]—홈 다음 위치. 마지막이 지금 페이지
home{ label: string; href: string }{ label: '홈', href: '/' }빵 부스러기 맨 앞
tabs{ label: string; href: string }[]—페이지 안 탭(#구역 또는 형제 페이지)
currentstring—지금 탭의 href

원본 코드

설치 명령 없이 그대로 복사해 넣어도 됩니다. React 외의 패키지는 쓰지 않습니다.

components/bpublish/page-hero.tsx
/**
 * bpublish UI — 하위 페이지 머리. https://www.bpublish.com/designs/components/page-hero
 * 사진 띠 위에 영문 한 줄과 페이지 제목, 그 아래 줄에 빵 부스러기(홈 / 현재 위치)와 페이지 안 탭.
 * 사진 위 글자는 검정 단색 막으로 읽히게 한다. 투명 머리글(site-header overlay) 아래에 놓아도 글자가 가리지 않는다.
 */
export type PageHeroLink = { label: string; href: string }

export type PageHeroProps = {
  title: string
  /** 제목 위 영문 한 줄 */
  eyebrow?: string
  image: string
  imageAlt?: string
  /** 홈 다음에 이어지는 위치. 마지막이 지금 페이지다 */
  crumbs?: { label: string; href?: string }[]
  /** 빵 부스러기 맨 앞 */
  home?: PageHeroLink
  /** 페이지 안 탭(같은 페이지의 #구역 또는 형제 페이지) */
  tabs?: PageHeroLink[]
  /** 지금 탭의 href */
  current?: string
  className?: string
}

const focus = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'

export function PageHero({ title, eyebrow, image, imageAlt = '', crumbs = [], home = { label: '홈', href: '/' }, tabs, current, className = '' }: PageHeroProps) {
  return (
    <div className={className}>
      <section className="relative isolate flex h-[380px] items-end overflow-hidden pt-32 pb-14 text-white md:h-[460px]">
        <img src={image} alt={imageAlt} className="absolute inset-0 -z-10 h-full w-full bg-muted object-cover" />
        <span aria-hidden className="absolute inset-0 -z-10 bg-black/45" />
        <div className="shell">
          {eyebrow ? <p className="text-[13px] font-semibold tracking-[0.3em] uppercase opacity-80">{eyebrow}</p> : null}
          <h1 className={`heading text-4xl leading-tight text-balance md:text-6xl ${eyebrow ? 'mt-3' : ''}`}>{title}</h1>
        </div>
      </section>

      <div className="border-b border-border">
        <div className="shell flex flex-col gap-3 py-4 md:flex-row md:items-center md:justify-between">
          <nav aria-label="현재 위치">
            <ol className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
              <li>
                <a href={home.href} className={`flex items-center gap-1.5 transition-colors hover:text-foreground ${focus}`}>
                  <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.5" aria-hidden>
                    <path d="M4 10.5 12 4l8 6.5V20h-5.5v-6h-5v6H4z" />
                  </svg>
                  {home.label}
                </a>
              </li>
              {crumbs.map((c, i) => {
                const last = i === crumbs.length - 1
                return (
                  <li key={`${c.label}-${i}`} className="flex items-center gap-2">
                    <span aria-hidden className="opacity-40">
                      /
                    </span>
                    {c.href && !last ? (
                      <a href={c.href} className={`transition-colors hover:text-foreground ${focus}`}>
                        {c.label}
                      </a>
                    ) : (
                      <span aria-current={last ? 'page' : undefined} className={last ? 'font-medium text-foreground' : ''}>
                        {c.label}
                      </span>
                    )}
                  </li>
                )
              })}
            </ol>
          </nav>

          {tabs?.length ? (
            <nav aria-label="페이지 안 이동" className="-mx-1 flex gap-1 overflow-x-auto px-1 py-0.5">
              {tabs.map((t) => {
                const on = t.href === current
                return (
                  <a
                    key={t.href}
                    href={t.href}
                    aria-current={on ? 'true' : undefined}
                    className={`shrink-0 rounded-full px-4 py-2 text-sm font-semibold transition-colors ${
                      on ? 'bg-foreground text-background' : 'text-muted-foreground hover:bg-muted hover:text-foreground'
                    } ${focus}`}
                  >
                    {t.label}
                  </a>
                )
              })}
            </nav>
          ) : null}
        </div>
      </div>
    </div>
  )
}