cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

              <html ng-app="ionicApp">

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>Ionic List Directive</title>

  <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
  <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>

<body ng-controller="MyCtrl">

  <ion-header-bar class="bar-positive">
    <h1 class="title">Accordion</h1>

      <ion-item ng-repeat="item in items" class="item item-text-wrap item-icon-right" ng-click="expandItem(item)">

        <div ng-class="isItemExpanded(item) ? 'expand-item active' : 'expand-item inactive'">
          <ion-option-button class="button-assertive icon-left ion-trash-b">
        <i ng-class="isItemExpanded(item) ? 'icon ion-chevron-down icon-accessory' : 'icon ion-chevron-right icon-accessory'"></i>


  position: relative;
  width: 100%;
  max-height: 32px;
  transition: max-height 0.1s ease-out;
  overflow: hidden;

.expand-item.active {
  max-height: 200px;
  transition: max-height 0.3s ease-out;

              angular.module('ionicApp', ['ionic'])

.controller('MyCtrl', function($scope) {
  $scope.items = [];
  for (var i = 0; i < 10; i++) {
    text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus id turpis vitae eros cursus viverra non eget ligula. Maecenas et mauris at justo auctor molestie pharetra bibendum dui. Fusce id dui vulputate, dictum diam ac, rhoncus erat. Integer facilisis dignissim iaculis. Aliquam imperdiet viverra dui, ac malesuada dolor dictum sit amet. Nulla cursus tellus at blandit suscipit. Cras tempus, eros sed luctus gravida, lacus ipsum lacinia nulla, in gravida leo mauris eu leo. Praesent in sem sed augue rutrum tempor. Nam at lectus iaculis metus lobortis euismod sit amet non nulla. Nullam vel magna pharetra, vehicula lacus malesuada, tincidunt mi. Vivamus sapien nibh, pulvinar et felis et, tristique consequat lacus. Curabitur sed venenatis turpis, condimentum mattis orci. Vestibulum maximus, nulla nec mattis lacinia, nibh purus sollicitudin orci, a iaculis nibh erat non leo.'
    $scope.items[i] = {
      Text: text
    $scope.expandItem = function(item) {
      if ($scope.isItemExpanded(item)) {
        $scope.shownItem = null;
      } else {
        $scope.shownItem = item;
    $scope.isItemExpanded = function(item) {
      return $scope.shownItem === item;


🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................