Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="kanban-canvas">
  <!-- ここにカンバンが表示される -->
</div>  
              
            
!

CSS

              
                /* カードの設定 */
.kanban-item .text-red {
  color: crimson;
}
.kanban-item .text-bold {
  font-weight: bold;
}
.kanban-item.orange {
  color: white;
  background-color: darkorange;
}
.kanban-item .item-body img {
  width: 100%;
}
.kanban-item .item-body {
  max-height: 240px;
  overflow: hidden;
}
/* カラムのタイトルの色 */
.kanban-board header {
  color: white;
  background-color: gray;
}
.kanban-board header.red {
  background-color: crimson;
}
.kanban-board header.blue {
  background-color: royalblue;
}
.kanban-board header.green {
  background-color: green;
}
              
            
!

JS

              
                // カンバンに表示されるカラムやカードを定義
const dataContent = [
  {
    "id": "column-id-1",
    "title": "Red",
    "class": "red",
    "item": [
      {
        "id": "item-id-1",
        "title": "<span class='text-red text-bold'>Card 1</span>",
        "username": "hoge"
      },
      {
        "id": "item-id-2",
        "title": "Card 2",
        "class": "orange",
        "username": "piyo"
      }
    ]
  },
  {
    "id": "column-id-2",
    "title": "Blue",
    "class": "blue",
    "item": [
      {
        "id": "item-id-3",
        "title": "<div class='item-title'>Card 3</div><div class='item-body'><img src='https://i.imgur.com/b1dGytP.jpeg' /></div>"
      }
    ]
  },
  {
    "id": "column-id-3",
    "title": "Green",
    "class": "green",
    "item": [
      {
        "id": "item-id-4",
        "title": "Card 4"
      },
      {
        "id": "item-id-5",
        "title": "Card 5"
      }
    ]
  }
];

// ここで jKanban を実行する
const kanban = new jKanban({
  element: '#kanban-canvas',  // カンバンを表示する場所のID
  boards: dataContent,        // カンバンに表示されるカラムやカードのデータ
  gutter: '16px',             // カンバンの余白
  widthBoard: '250px',        // カラムの幅 (responsivePercentageの「true」設定により無視される)
  responsivePercentage: true, // trueを選択時はカラム幅は%で指定され、gutterとwidthBoardの設定は不要
  dragItems: true,            // trueを選択時はカードをドラッグ可能
  dragBoards: true            // カラムをドラッグ可能にするかどうか
});

// カードに data-class= 属性が設定されていたら、
// その値を取得してクラス名に追加する。
document.querySelectorAll('.kanban-item').forEach(item => {
  if (item.dataset.class) {
        item.classList.add(item.dataset.class);
  }
});
              
            
!
999px

Console