Article

Article provides styles to common element selectors to create an article in a content page.

Overview

Article can be used on any content page that displays large blocks of text-driven information. It's meant to be used as a standalone element and should not be nested inside any other components that may change the background color from the anticipated one. In the event that you must nest an article inside another component, please ensure that you set the article's background color to the default body color.

Supported Elements

Headings

Article Meta

Meta is used if there is metadata information about your article (i.e. author name, date, etc). Meta is a custom directive of article and is not a native element selector. To use it, add daffArticleMeta to a paragraph (<p>).

The link style in an article uses the default browser link style.

Table

Lists

Unordered List

Ordered List

Code

These are styles for inline and multiline blocks of code.

Inline code

Code blocks

Horizontal Rules

Blockquote

Encapsulation

Articles also support other custom "non-native" components like accordions, media galleries, and lists. Unlike typical HTML (

,

    ,
      , etc) content, these components must be style encaspulated to prevent article styles bleeding down from the article into their content. Many Daffodil components support this out of the box. If you have a custom component that you would like to place inside an article, you can use the DaffArticleEncapsulatedDirective on your component to prevent article styles bleeding into your component.

      Usage

      Within a standalone component

      To use article in a standalone component, import it directly into your custom component:

      @Component({
        selector: 'custom-component',
        templateUrl: './custom-component.component.html',
        standalone: true,
        imports: [
          DAFF_ARTICLE_COMPONENTS,
        ],
      })
      export class CustomComponent {}
      

      Within a module (deprecated)

      To use article in a module, import DaffArticleModule into your custom module:

      import { NgModule } from '@angular/core';
      
      import { DaffArticleModule } from '@daffodil/design/article';
      
      @NgModule({
          declarations: [
          CustomComponent,
        ],
        exports: [
          CustomComponent,
        ],
        imports: [
          DaffArticleModule,
        ],
      })
      export class CustomComponentModule { }
      

      This method is deprecated. It's recommended to update all custom components to standalone.

Graycore, LLC © 2018 - 2024. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.