---
description: Guidelines for developing custom blocks in Optimizely CMS
product: cms-paas
productVersion: "12.0"
category: backend
priority: high
applicableProducts:
  - cms-paas
globs:
  - "*.cs"
  - "*/Blocks/*"
  - "*/Models/*"
alwaysApply: false
version: 1.0.0
---
# Custom Block Development Guidelines

## Block Structure
- Inherit from `BlockData` for content blocks
- Use `[ContentType]` attribute for registration
- Follow naming convention: `*Block.cs`

## Best Practices
- **Important**: Always implement `IContent` interface
- Use `[Display]` attributes for editor experience
- Consider mobile-first design for rendered output

## Code Example
```csharp
[ContentType(DisplayName = "Hero Block", GUID = "12345")]
public class HeroBlock : BlockData
{
    [Display(Name = "Heading")]
    public virtual string Heading { get; set; }
    
    [Display(Name = "Description")]
    public virtual XhtmlString Description { get; set; }
}
```

## Registration
Blocks are automatically registered when implementing the proper interfaces and attributes.

## Template Development
- Create corresponding view files in Views/Shared/Blocks/
- Use strongly-typed views: `@model HeroBlock`
- Follow responsive design principles
