Skip to Content
React

Image Frame

사용자가 업로드한 이미지를 표시하기 위한 컴포넌트입니다.

사용 가능 버전@seed-design/react@1.2.0, @seed-design/css@1.2.0

Usage

import { ImageFrame } from "@seed-design/react";
import { ContentPlaceholder } from "seed-design/ui/content-placeholder";
<ImageFrame
  ratio={4 / 3}
  borderRadius="r2"
  stroke
  src="..."
  alt="..."
  fallback={<ContentPlaceholder type="image" />}
/>

Props

Prop

Type

background?ScopedColorBanner | ScopedColorBg | ScopedColorPalette | (string & {}) | undefined
backgroundGradient?"fadeMask" | "glowMagic" | "glowMagicPressed" | "highlightMagic" | "highlightMagicPressed" | "shimmerMagic" | "shimmerNeutral" | undefined
color?ScopedColorFg | ScopedColorPalette | (string & {}) | undefined
borderColor?ScopedColorPalette | ScopedColorStroke | (string & {}) | undefined
borderWidth?0 | 1 | (string & {}) | undefined
borderTopWidth?0 | 1 | (string & {}) | undefined
borderRightWidth?0 | 1 | (string & {}) | undefined
borderBottomWidth?0 | 1 | (string & {}) | undefined
borderLeftWidth?0 | 1 | (string & {}) | undefined
borderRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderTopLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderTopRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderBottomRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderBottomLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
boxShadow?"s1" | "s2" | "s3" | (string & {}) | undefined
width?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefined
minWidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefined
maxWidth?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefined
height?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefined
minHeight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefined
maxHeight?ResponsiveValue<"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {})> | undefined
top?0 | (string & {}) | undefined
left?0 | (string & {}) | undefined
right?0 | (string & {}) | undefined
bottom?0 | (string & {}) | undefined
padding?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
paddingX?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
paddingY?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
paddingTop?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
paddingRight?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
paddingBottom?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
paddingLeft?ResponsiveValue<"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
display?ResponsiveValue<"block" | "flex" | "grid" | "inline" | "inline-block" | "inline-flex" | "none"> | undefined
zIndex?number | (string & {}) | undefined
flexDirection?ResponsiveValue<"column" | "column-reverse" | "row" | "row-reverse"> | undefined
justifyContent?"center" | "flex-end" | "flex-start" | "space-around" | "space-between" | undefined
alignItems?"center" | "flex-end" | "flex-start" | "stretch" | undefined
alignContent?"center" | "flex-end" | "flex-start" | "stretch" | undefined
alignSelf?"center" | "flex-end" | "flex-start" | "stretch" | undefined
gap?ResponsiveValue<"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {})> | undefined
gridColumn?string | undefined
gridRow?string | undefined
unstable_transform?string | undefined
_active?{ bg?: ScopedColorBg | ScopedColorPalette | (string & {}); background?: ScopedColorBg | ScopedColorPalette | (string & {}); } | undefined
as?React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined
asChild?boolean | undefined
hideFrom?BreakpointThreshold | undefined
srcstring
altstring
fallback?React.ReactNode
loading?"eager" | "lazy" | undefined
decoding?"async" | "auto" | "sync" | undefined
crossOrigin?"" | "anonymous" | "use-credentials" | undefined
referrerPolicy?React.HTMLAttributeReferrerPolicy | undefined
sizes?string | undefined
srcSet?string | undefined
children?React.ReactNode

Examples

Ratio

다양한 비율을 지정할 수 있습니다. 1은 정사각형, 4/3은 일반적인 사진 비율, 16/9는 와이드스크린 비율입니다.

Border Radius

borderRadius prop으로 모서리 라운드 스타일을 적용할 수 있습니다. 기본값은 "r2"입니다.

Stroke

stroke prop으로 테두리 스타일을 적용할 수 있습니다.

Fallback Image

fallback prop으로 이미지가 로드되지 않았을 때 보여질 요소를 지정할 수 있습니다. 주로 ContentPlaceholder를 사용합니다.

Overlay

ImageFrameFloater를 사용하여 이미지 위에 오버레이 요소를 배치할 수 있습니다. ImageFrameBadge, ImageFrameIcon, ImageFrameIndicator, ImageFrameReactionButton 등 다양한 오버레이 컴포넌트를 제공합니다.

Multiple Overlays

여러 위치에 오버레이를 동시에 배치할 수 있습니다.

Custom Overlay

ImageFrameFloater는 모든 React 요소를 children으로 받을 수 있습니다. 미리 정의된 오버레이 컴포넌트 외에도 커스텀 UI를 배치할 수 있습니다.

Offset

offsetX, offsetY prop으로 오버레이의 여백을 조절할 수 있습니다. 기본값은 6px입니다.

Extending to Safe Area

bleedX="safeArea"를 지정하면 이미지가 좌우 safe area inset까지 화면 끝으로 넓어집니다. 이때 ImageFrameFloater는 offsetX에 해당 방향의 inset을 더해 safe area 안에 놓입니다. AppScreenContent처럼 inset을 반영한 컨테이너 바로 안에서 사용하세요. 화면 끝까지 채우는 다른 방법은 Safe Area 구현 가이드를 참고하세요.

배지의 위치 보정은 bleed prop을 기준으로 계산합니다. bleed와 함께 style이나 className으로 같은 방향의 margin을 덮어쓰지 마세요. margin만 바꾸면 배지의 보정값은 그대로 남습니다. 한쪽 확장을 끄려면 bleedX="safeArea" bleedLeft={0}처럼 해당 방향의 bleed를 지정하고, 추가 여백은 바깥 컨테이너에서 조절하세요.

아래 예제는 좌우에 가상의 inset을 적용합니다. 붉은 빗금은 콘텐츠를 피해야 하는 inset 영역이며, 두 경계선 사이는 안전 영역입니다. 스위치로 확장 전(AS IS)과 확장 후(TO BE)를 비교하고, 배경·스크롤 영역의 경계와 콘텐츠 위치를 확인하세요. 같은 버전에서 옵션을 끄고 켠 비교입니다.

비교용 inset: 왼쪽 24px · 오른쪽 48px (가상)

붉은 빗금은 콘텐츠를 피해야 하는 inset 영역이며, 두 경계선 사이는 안전 영역입니다.

Last updated on

목차