# Article URL: /react/components/article Source: https://github.com/daangn/seed-design/blob/dev/docs/content/react/components/article.mdx Article is a utility component that helps use consistent selection and line-break policies. 사용 가능 버전: @seed-design/react@1.0.6, @seed-design/css@1.0.6 ## Preview ```tsx import { Article, Text, VStack } from "@seed-design/react"; export default function ArticlePreview() { return (
Article은 일관된 selection 및 줄바꿈 정책을 사용할 수 있게 돕는 유틸리티 컴포넌트입니다. 여기를 드래그해서 선택해보세요.
); } ``` ## Usage ```tsx import { Article } from "@seed-design/react"; ``` ```tsx
Article
``` ## Props Same as [BoxProps](/react/components/layout/box#props). ## Examples ### Word Break Behavior Sets word-break behavior based on language inferred through the [`lang` global attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang). In Korean documents/elements, line breaks are prevented within a phrase, while other languages follow standard rules. Line breaks occur within words longer than the container. In Japanese, line breaks are adjusted to prevent awkward positions, such as before punctuation, before small kana, before iteration marks, and similar. ```tsx import { Article, Text, VStack } from "@seed-design/react"; export default function ArticleWordBreak() { return (
ja-JP 日本語の禁則処理では、特定の文字の前後で改行を制御します。例えば人々々々と続く場合や、小さい文字ぁぁぁが連続する場合、そして句読点。。。が続く場合の改行位置を確認できます。 また長い文章では自動的に適切な位置で改行されますが々ぁ。などの文字の前では改行されないことを確認してください。{" "} https://www.example.com/this-is-a-very-long-url-that-might-cause-layout-issues-if-the-word-break-is-not-handled-properly?utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale
핸들을 잡고 너비를 조정해보세요.
); } ``` ### User Select Behavior Elements inside `
` can be selected by users. ```tsx import { IconExclamationmarkCircleFill } from "@karrotmarket/react-monochrome-icon"; import { Article, Divider, Icon, Text, VStack } from "@seed-design/react"; import { PageBanner } from "seed-design/ui/page-banner"; export default function ArticleSelectable() { return ( } description="상위 요소에 `user-select: none;` 스타일 적용됨" tone="warning" variant="solid" /> Article 밖은 선택할 수 없습니다. 상위 요소에 `user-select: none;` 스타일이 적용되어 있어 이 영역의 텍스트는 선택할 수 없습니다. 길게 탭하거나 더블 클릭해보세요.
Article 안 상위 요소에 `user-select: none;` 스타일이 적용되었지만 Article 내부는 선택할 수 있습니다. 길게 탭하거나 더블 클릭해서 텍스트를 선택해보세요.
Article 밖은 선택할 수 없습니다. 길게 탭하거나 더블 클릭해보세요.
); } ``` #### Disable User Selection You can make elements inside `
` non-selectable using the Text component's [`userSelect="none"` prop](/react/components/typography/text#user-select). Learn more about the Text component. ```tsx import { IconExclamationmarkCircleFill } from "@karrotmarket/react-monochrome-icon"; import { Article, Divider, Icon, Text, VStack } from "@seed-design/react"; import { PageBanner } from "seed-design/ui/page-banner"; export default function ArticleSelectable() { return ( } description="상위 요소에 `user-select: none;` 스타일 적용됨" tone="warning" variant="solid" /> Article 밖은 선택할 수 없습니다. 상위 요소에 `user-select: none;` 스타일이 적용되어 있어 이 영역의 텍스트는 선택할 수 없습니다. 길게 탭하거나 더블 클릭해보세요.
Article 안 상위 요소에 `user-select: none;` 스타일이 적용되었지만 Article 내부는 선택할 수 있습니다. 길게 탭하거나 더블 클릭해서 텍스트를 선택해보세요. 이 요소는 Article 내부에 있지만 선택할 수 없습니다.
Article 밖은 선택할 수 없습니다. 길게 탭하거나 더블 클릭해보세요.
); } ``` #### Prevent `PullToRefresh` or `TabsCarousel` Gestures Elements inside `
` can be selected by users. Therefore, when selecting inner elements through drag gestures, unintended PTR (pull-to-refresh) or tab swipe gestures may occur. You can pass `PullToRefresh.preventPull` or `Tabs.carouselPreventDrag` to `
` to prevent events generated from Article from triggering gestures. Learn how to specify areas to prevent gestures in the PullToRefresh component. Learn how to specify areas to prevent gestures in the TabsCarousel component. ```tsx import { VStack, Icon, Text, Article, Divider, PullToRefresh } from "@seed-design/react"; import { type StaticActivityComponentType } from "@stackflow/react/future"; import { AppBar, AppBarMain } from "seed-design/ui/app-bar"; import { AppScreen, AppScreenContent } from "seed-design/ui/app-screen"; import { PullToRefreshContent, PullToRefreshIndicator, PullToRefreshRoot, } from "seed-design/ui/pull-to-refresh"; import { IconExclamationmarkCircleFill } from "@karrotmarket/react-monochrome-icon"; import { PageBanner } from "seed-design/ui/page-banner"; declare module "@stackflow/config" { interface Register { ActivityArticlePreventPull: {}; } } const ActivityArticlePreventPull: StaticActivityComponentType< "ActivityArticlePreventPull" > = () => { return ( Pull To Refresh {}} onPtrRefresh={async () => { await new Promise((resolve) => setTimeout(resolve, 1000)); }} > } description="상위 요소에 `user-select: none;` 스타일 적용됨" tone="warning" variant="solid" />
Article 이 요소는 Article 내부에 있으므로 텍스트 선택이 가능합니다. 이 Article은 PTR 제스처를 호출하지 않도록 설정되어 있습니다. 여기를 아래로 끌어 당기면 PTR이 작동하는 대신 텍스트가 선택됩니다.
Article 외부 이 요소는 Article 외부에 있으므로 텍스트 선택이 불가능합니다. 이 요소는 PTR을 호출할 수 있습니다. 여기를 아래로 끌어 당겨보세요.
); }; export default ActivityArticlePreventPull; ``` ```tsx import { VStack, Icon, Text, Article, Divider, Tabs } from "@seed-design/react"; import { type StaticActivityComponentType } from "@stackflow/react/future"; import { AppBar, AppBarMain } from "seed-design/ui/app-bar"; import { AppScreen, AppScreenContent } from "seed-design/ui/app-screen"; import { TabsCarousel, TabsContent, TabsList, TabsRoot, TabsTrigger } from "seed-design/ui/tabs"; import { IconExclamationmarkCircleFill } from "@karrotmarket/react-monochrome-icon"; import { PageBanner } from "seed-design/ui/page-banner"; declare module "@stackflow/config" { interface Register { ActivityArticlePreventDrag: {}; } } const ActivityArticlePreventDrag: StaticActivityComponentType< "ActivityArticlePreventDrag" > = () => { return ( Tabs Tab 1 Tab 2 } description="상위 요소에 `user-select: none;` 스타일 적용됨" tone="warning" variant="solid" />
Article 이 요소는 Article 내부에 있으므로 텍스트 선택이 가능합니다. 이 Article은 Tabs 제스처를 호출하지 않도록 설정되어 있습니다. 여기를 왼쪽으로 스와이프하면 탭이 전환되는 대신 텍스트가 선택됩니다.
Article 외부 이 요소는 Article 외부에 있으므로 텍스트 선택이 불가능합니다. 이 요소는 탭 스와이프를 호출할 수 있습니다. 여기를 왼쪽으로 스와이프해보세요.
안녕하세요!
); }; export default ActivityArticlePreventDrag; ``` ### Using `asChild` or `as` prop `
` renders as `
` by default, but can be changed to another element using the `asChild` or `as` prop. Learn more about the `asChild` prop. ```tsx import { Article, Divider, VStack, Text } from "@seed-design/react"; export default function ArticleAs() { return (
`as` prop으로 Article을 section으로 변경 Nulla exercitation quis aliqua nostrud.
`asChild` prop으로 Article을 section으로 변경 Elit fugiat elit exercitation laborum id veniam consequat ipsum sit voluptate velit.
); } ```